fastglm_prepare: Prepare a reusable design for repeated GLM fits

View source: R/prepared.R

fastglm_prepareR Documentation

Prepare a reusable design for repeated GLM fits

Description

Records the predictors and weights shared by several outcome models. Formula inputs also retain the factor coding and transformations needed for prediction. Gaussian identity fits can reuse their matrix decomposition, the expensive calculation that depends only on predictors and weights. Dense Firth fits with Gaussian identity, Gamma log, or Poisson square-root links also reuse their common decomposition and bias-adjustment setup with the automatic or LLT solver. Saved calculations are rebuilt when predictors or weights change. Mean-bias-reduced Gaussian identity, Gamma log, and Poisson square-root fits also reuse the observation leverages needed for the adjusted score. A leverage measures how strongly a row contributes to the fitted regression. The shared setup is used by 'method = "auto"' and 'method = "llt"' (or '2').

Usage

fastglm_prepare(x, data = NULL, weights = NULL, offset = NULL, firth = FALSE)

Arguments

x

model matrix or a one-sided formula.

data

data frame for a formula.

weights, offset

optional common weights and offsets.

firth

default for mean bias reduction in subsequent batch fits.

Value

A 'fastglm_design' object for [fastglm_batch()].


fastglm documentation built on Nov. 11, 2026, 5:07 p.m.