spikeSlabGAM
This function generates the design matrix for a generalized additive (mixed)
model, based on smoothing spline ANOVA-like orthogonal decomposition of the
model terms and their interactions. It parses the formula given to
spikeSlabGAM
to provide all the arguments necessary for the
MCMC sampler.
ssGAMDesign(
formula,
data,
specials = c("u", "lin", "fct", "sm", "rnd", "mrf", "srf"),
minUniqueValues = 6,
lowRankInteractions = TRUE,
orthogonalizeInteractions = TRUE,
decomposition = NULL
)
the model formula. Follows the usual R syntax described in
formula
. Terms in the formula that are not in the list
of specials are automatically assigned an appropriate special, i.e.
numerical covariates x
are treated as lin(x) + sm(x)
, factors
f
are treated as fct(f)
(see specials
argument). See
spikeSlabGAM
for more details.
data.frame
containing all the variables in the function
a vector of the types of possible model terms. These must be
implemented as functions generating a design matrix with a label attribute.
See also sm()
for an example. The documentation for
spikeSlabGAM
contains a list of implemented model term types
and usage examples.
the minimal number of unique values a covariate has to have in order to not be treated as a factor. Defaults to 6.
should a low-rank approximation of the design matrix for interaction terms based on a (truncated) spectral decomposition of the implied covariance matrix be used? defaults to TRUE.
should the design matrices for interaction terms be projected into the complement of the column space of the respective main effects? Can help separate marginal and interaction effects. Defaults to TRUE.
a list with components:
the left hand side of the model formula
the design matrix of the model specified in formula
a factor that maps the columns of
Design
to the different model terms
a matrix containing the hierarchy of the penalization groups (not used, included for backwards compatibility)
Setting lowRankInteractions
to FALSE can result in very large models,
especially if higher-order interactions or interactions between terms with
lots of parameters are involved. Note that numeric covariates with fewer
unique values than minUniqueValues
are treated as factors unless
wrapped in a special argument.
This function is not meant to be called directly by the user,
spikeSlabGAM
is the user interface.