PolyGenius
Contents

RegressionFamily

Internal base class for regression families

RegressionFamily defines the shared interface implemented by each regression family used by associate$regression() and the evaluate engine. Concrete subclasses provide validation, fitting, summary-row generation, artifact production, and diagnostics.

The base class owns the orchestration contract only. Subclasses implement:

  • validate.frame() -- reject unsupported specifications
  • prepare.frame() -- shape family-specific fit data from the resolved frame
  • build.formula() -- construct the model formula
  • fit.model() -- fit the underlying model object
  • build.summary.rows() -- translate fits to standardized result rows
  • build.artifacts() -- expose plot-ready artifacts
  • build.diagnostics() -- expose fit-level diagnostic information

Public fields

family.name — Canonical short family key (e.g. "lm"), set by initialize().

grid.resolution — Number of points used when building numeric prediction-grid artifacts. Set per run from the engine specification.

Methods

Public methods

  • RegressionFamily$new()
  • RegressionFamily$run()
  • RegressionFamily$validate.frame()
  • RegressionFamily$prepare.frame()
  • RegressionFamily$build.formula()
  • RegressionFamily$fit.model()
  • RegressionFamily$build.summary.rows()
  • RegressionFamily$build.artifacts()
  • RegressionFamily$build.diagnostics()
  • RegressionFamily$describe.model.terms()
  • RegressionFamily$clone()

Method new()

Store the canonical family key.

Usage

RegressionFamily$new(family.name)

Arguments

family.name — Canonical short name for this family.

Method run()

Orchestrate one fit context and return a complete PolyGeniusAssociation object.

Usage

RegressionFamily$run(context)

Arguments

context — Fully resolved fit context list with fields: frame, cell, fit.specs, conf.level.

Returns

A PolyGeniusAssociation.

Method validate.frame()

Validate one fit cell before model construction. The base implementation accepts everything; concrete families override this to reject unsupported specifications (e.g. wrong number of time/event columns).

Usage

RegressionFamily$validate.frame(frame, cell, fit.specs, conf.level)

Arguments

frame — data.table resolved from PolyGeniusStudy.

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

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

conf.level — Numeric confidence level (0-1).

Returns

TRUE, invisibly.

Method prepare.frame()

Build the family-specific fit payload. Must be implemented by concrete regression families.

Usage

RegressionFamily$prepare.frame(frame, cell, fit.specs, conf.level)

Arguments

frame — data.table resolved from PolyGeniusStudy.

cell — Fit-cell list.

fit.specs — Extra fitting options.

conf.level — Numeric confidence level.

Returns

Named list of family-specific fit data (e.g. data, predictor.name, row.id).

Method build.formula()

Build the model formula. Must be implemented by concrete regression families.

Usage

RegressionFamily$build.formula(frame)

Arguments

frame — List returned by prepare.frame().

Returns

A formula object, typically carrying a "display.formula" attribute.

Method fit.model()

Fit the underlying model. Must be implemented by concrete regression families.

Usage

RegressionFamily$fit.model(formula, frame, ...)

Arguments

formula — Formula from build.formula().

frame — List returned by prepare.frame().

... — Extra fitting arguments forwarded from the user call.

Returns

A fitted model object (family-specific class).

Method build.summary.rows()

Produce standardized result rows. Must be implemented by concrete regression families.

Usage

RegressionFamily$build.summary.rows(
  fit,
  fit.data,
  cell,
  fit.specs,
  conf.level,
  formula
)

Arguments

fit — Fitted model object from fit.model().

fit.data — List returned by prepare.frame().

cell — Fit-cell list.

fit.specs — Extra fitting options.

conf.level — Numeric confidence level.

formula — Display formula string stored in the result rows.

Returns

A data.table of standardized result rows.

Method build.artifacts()

Return optional plot-support artifacts. The base implementation returns none; concrete families override this to supply e.g. survival curves or prediction grids.

Usage

RegressionFamily$build.artifacts(
  fit,
  fit.data,
  cell,
  fit.specs,
  conf.level,
  formula
)

Arguments

fit — Fitted model object from fit.model().

fit.data — List returned by prepare.frame().

cell — Fit-cell list.

fit.specs — Extra fitting options.

conf.level — Numeric confidence level.

formula — Display formula string.

Returns

Named list of artifact tables; empty by default.

Method build.diagnostics()

Return optional fit-level diagnostics. The base implementation returns none; concrete families override this to supply family-specific diagnostic information.

Usage

RegressionFamily$build.diagnostics(fit, fit.data, cell, fit.specs, conf.level)

Arguments

fit — Fitted model object from fit.model().

fit.data — List returned by prepare.frame().

cell — Fit-cell list.

fit.specs — Extra fitting options.

conf.level — Numeric confidence level.

Returns

Named list of diagnostic information; empty by default.

Method describe.model.terms()

Describe the model terms whose data must be inspected for estimability before fitting. Returns a list of list(column, role, label) records where column keys into fit.data$data, role drives the estimability test, and label is the user-facing column name. The default covers the right-hand-side terms shared by every family (predictor, interaction, covariates) plus a survival event term when one is present; families add outcome-specific terms by extending it.

Usage

RegressionFamily$describe.model.terms(fit.data)

Arguments

fit.data — List returned by prepare.frame().

Returns

List of term descriptor records.

Method clone()

The objects of this class are cloneable with this method.

Usage

RegressionFamily$clone(deep = FALSE)

Arguments

deep — Whether to make a deep clone.

See Also