ssGAMDesign: Generate design and model information for 'spikeSlabGAM'

View source: R/ssGAMDesign.R

ssGAMDesignR Documentation

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 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

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 spikeSlabGAM contains a list of implemented model term types and usage examples.

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.

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.

Value

a list with components:

response

the left hand side of the model formula

Design

the design matrix of the model specified in formula

groupIndicators

a factor that maps the columns of Design to the different model terms

H

a matrix containing the hierarchy of the penalization groups (not used, included for backwards compatibility)

Author(s)

Fabian Scheipl


fabian-s/spikeSlabGAM documentation built on June 18, 2022, 7:22 p.m.