LinearRegression

Linear-regression family for associate$regression()

Description

LinearRegression implements Gaussian linear regression for associate$regression(). It supports covariate adjustment, split.by through the engine fit grid, and predictor-by-modifier interactions.

Summary rows follow the lm association schema on the identity scale. Returned artifacts are:

  • prediction.grid, a plotting-ready effect grid for the tested predictor

Super class

PolyGenius::RegressionFamily -> LinearRegression

Methods

Public methods

Inherited methods

Method new()

Register the canonical family key used by the engine.

Usage
LinearRegression$new()
Returns

The initialized family object with family.name = “lm”.


Method prepare.frame()

Build the complete-case linear-regression payload.

Usage
LinearRegression$prepare.frame(frame, cell, fit.specs, conf.level)
Arguments
frame

Cell-specific PolyGeniusFrame.

cell

Named fit-grid cell.

fit.specs

Additional family-specific fitting arguments.

conf.level

Confidence level for intervals.

Returns

A model-ready fit payload.


Method build.formula()

Build the linear-model formula for one fit payload.

Usage
LinearRegression$build.formula(frame)
Arguments
frame

Fit payload returned by prepare.frame().

Returns

A model formula object.


Method fit.model()

Fit the linear model for one regression cell.

Usage
LinearRegression$fit.model(formula, frame, ...)
Arguments
formula

Model formula returned by build.formula().

frame

Fit payload returned by prepare.frame().

Additional arguments passed to stats::lm().

Returns

A fitted stats::lm object.


Method build.summary.rows()

Convert the fitted linear model to regression-schema rows.

Usage
LinearRegression$build.summary.rows(
  fit,
  fit.data,
  cell,
  fit.specs,
  conf.level,
  formula
)
Arguments
fit

Fitted stats::lm object.

fit.data

Fit payload returned by prepare.frame().

cell

Named fit-grid cell.

fit.specs

Additional family-specific fitting arguments.

conf.level

Confidence level for intervals.

formula

Display formula string.

Returns

A data frame following the concrete association schema.


Method build.artifacts()

Return effect-grid and profile artifacts.

Usage
LinearRegression$build.artifacts(
  fit,
  fit.data,
  cell,
  fit.specs,
  conf.level,
  formula
)
Arguments
fit

Fitted stats::lm object.

fit.data

Fit payload returned by prepare.frame().

cell

Named fit-grid cell.

fit.specs

Additional family-specific fitting arguments.

conf.level

Confidence level for intervals.

formula

Display formula string.

Returns

A named list with prediction.grid and profile.table.


Method clone()

The objects of this class are cloneable with this method.

Usage
LinearRegression$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.