Learn R Programming

spikeSlabGAM (version 1.1-7)

ssGAMDesign: Generate design and model information for spikeSlabGAM

Description

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.

Usage

ssGAMDesign(formula, data,
    specials = c("u", "lin", "fct", "sm", "rnd", "mrf", "srf"),
    minUniqueValues = 6, lowRankInteractions = TRUE,
    orthogonalizeInteractions = TRUE, decomposition = NULL)

Arguments

formula
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
data
data.frame containing all the variables in the function
specials
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
minUniqueValues
the minimal number of unique values a covariate has to have in order to not be treated as a factor. Defaults to 6.
lowRankInteractions
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.
orthogonalizeInteractions
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.
decomposition
which decomposition to use, see sm. Defaults to the default of sm.

Value

  • a list with components:
  • responsethe left hand side of the model formula
  • Designthe design matrix of the model specified in formula
  • groupIndicatorsa factor that maps the columns of Design to the different model terms
  • Ha matrix containing the hierarchy of the penalization groups (not used, included for backwards compatibility)

Details

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.