R/ordinal-prepared.R
fastglm_ordinal_prepare.RdRetains a dense location design and its prediction coding for use with
fastglm_ordinal() or fastglm_ordinal_batch(). Repeated fits reuse weighted
centering, scaling, rank checks, and the transformed design when the
predictors and effective row frequencies agree. Model scores, information,
category mappings, and starting thresholds are recalculated for each fit.
fastglm_ordinal_prepare(
x,
data = NULL,
weights = NULL,
offset = NULL,
levels = NULL,
firth = FALSE,
link = "logit",
nonparallel = NULL
)a dense numeric matrix without an intercept, or a one-sided formula.
data for a formula.
default fitting frequencies and location offsets.
Formula offsets and an additional offset argument are combined during
preparation. Predictors must be complete; missing rows are not removed.
optional default outcome labels in increasing order.
default for mean bias reduction in subsequent fits.
default cumulative link, as in fastglm_ordinal().
default predictors whose slopes may differ across
thresholds. Select complete terms with a one-sided formula for a prepared
formula, or columns by name or index for a matrix. Omitting this argument
in subsequent fits uses the prepared selection; explicitly supplying
NULL fits common slopes for all predictors.
A fastglm_ordinal_design object. Its cache environment is shared
by repeated fits; each fitted model retains its own response and the common
original design, without copying the cached transformed design into the fit.
The cache contains ordinary R objects and can be saved with
saveRDS(). Changing the design, effective row totals, selected
nonparallel terms, or the standardize optimizer control rebuilds the
relevant setup. For grouped
counts, effective totals are counts times their fitting weights. Changing
category allocations while retaining those totals permits reuse.
Fitting with a prepared design preserves the formula's factor coding and
transformations for prediction. A replacement fitting offset is a total
location offset. After changing prepared formula offsets, predictions on
new data require an explicit replacement offset.