Z
design matrix (or list of such matrices if formula is a list))
S
list of penalty matrices (with names based on the response terms of the formulas as well as the smooth terms and covariates). For tensorproduct smooths, corresponding entries are themselves lists, containing the \(d\) marginal penalty matrices if \(d\) is the dimension of the tensor product)
pardim
list of parameter dimensions (fixed and penalised separately) for each formula, for ease of setting up initial parameters
coef
list of coefficient vectors filled with zeros of the correct length for each formula, for ease of setting up initial parameters
sp0
named vector of initial penalty strengths, with one entry per penalty matrix and names matching S (a smooth with several penalties, e.g. a tensor product, contributes one entry each, named <smooth>.<margin>).
These are initial.sp's guesses times 100, capped at 1e6: the inner optimisation is better behaved when it starts constrained, and the outer iteration relaxes the penalty from there.
It can be passed straight to penalty or penalty2 when each smooth appears once.
When a smooth is replicated, e.g. one spline per state, use rep_sp, as a single rep() over sp0 is only correct for some models.
formula
the formula(s) as supplied, in the same nesting as Z
data
the data frame used for the model(s)
gam
unfitted mgcv::gam object used for construction of Z and S (or list of such objects if formula is a list). Its X element is not kept, as it is returned as Z
gam0
fitted mgcv::gam which is used internally to create prediction design matrices (or list of such objects if formula is a list)
knots
knot list used in the basis construction (or named list over such lists if formula is a list)