PolyGenius
Contents

ComparisonFamily

Internal base class for comparison families

ComparisonFamily dispatches the incremental, heterogeneity and contrast comparisons for associate$compare(). Each subclass fits one outcome family. Subclasses override validate.context() and prepare.data(), and implement the three private run.*() methods.

Public fields

family.name — Canonical short name for this comparison family (e.g. "lm", "glm", "cox").

Methods

Public methods

  • ComparisonFamily$new()
  • ComparisonFamily$run()
  • ComparisonFamily$validate.context()
  • ComparisonFamily$prepare.data()
  • ComparisonFamily$clone()

Method new()

Store the canonical family key.

Usage

ComparisonFamily$new(family.name)

Arguments

family.name — Canonical short name for this family.

Method run()

Dispatch to the comparison type (incremental, heterogeneity or contrast). The type comes from fit.specs$type, then cell$type, and defaults to "incremental". Calls validate.context() then prepare.data() before routing.

Usage

ComparisonFamily$run(context)

Arguments

context — List with fields frame, cell, fit.specs and conf.level.

Returns

A PolyGeniusAssociation.

Method validate.context()

Validate the frame before dispatching. Subclasses override this; the base version accepts everything.

Usage

ComparisonFamily$validate.context(frame, cell, fit.specs, type)

Arguments

frame — data.table resolved from the study.

cell — Fit-cell list (outcome, predictor, stratum, etc.).

fit.specs — Extra fitting options from the user call.

type — Comparison type: "incremental", "heterogeneity" or "contrast".

Returns

TRUE, invisibly, or an abort.

Method prepare.data()

Extract family-specific clean data from the resolved frame. Subclasses override this; the base version aborts.

Usage

ComparisonFamily$prepare.data(frame, cell, fit.specs)

Arguments

frame — data.table resolved from the study.

cell — Fit-cell list.

fit.specs — Extra fitting options.

Returns

A list of ready-to-use fit inputs.

Method clone()

The objects of this class are cloneable with this method.

Usage

ComparisonFamily$clone(deep = FALSE)

Arguments

deep — Whether to make a deep clone.

See Also