
get_matrix
is a first attempt at a unified extractor of various matrices from a fit. All augmented matrices follow (Henderson's) block order (upper blocks: X,Z; lower blocks: 0,I).
get_ZALMatrix
returns the design matrix for the random effects
get_matrix(object, which="model.matrix", augmented=TRUE, ...)
get_ZALMatrix(object, as_matrix, force_bind=FALSE)
An object of class HLfit
, as returned by the fitting functions in spaMM
.
Boolean; whether to return an augmented matrix for all model coefficients (fixed-effects coefficients and random-effect predictions) or only for fixed effects. Not operative for all which
values (currently only for which="left_ginv"
).
Which element to extract. For "model.matrix"
, the design matrix for fixed effects (similarly to stats::model.matrix
); for "ZAL"
, the design matrix for random effects (same as codeget_ZALMatrix()); for "AugX"
, the (unweighted) augmented design matrix of the least-square problem; for "hat_matrix"
, the projection matrix that gives model predictions from the (augmented) response vector; for "left_ginv"
, the pseudo-inverse that gives the model coefficients from the (augmented) response vector. See Details for definitiosn and further options.
Deprecated.
Boolean; with the default value FALSE
, the function may return an object of class ZAXlist
, which is poorly documented and for development purposes only.
Other arguments that may be needed in some future versions of spaMM
.
A matrix, possibly in sparse-matrix format.
(Given the pain that is to to write maths in R documentation files, readers are gently asked to be tolerant about any imperfections of the following).
Model coefficents estimates of a (weighted) linear model can be written as
get_matrix
returns, for given values of the which
argument, the following matrices from the model fit: "AugX"
: X; "wei_AugX"
: WX; "wAugX"
: "left_ginv"
: "hat_matrix"
: