model.matrix {BoomSpikeSlab}R Documentation



Extract the matrix of predictors.


  GetPredictorMatrix(object, newdata, na.action = na.omit, ...)



An object of class glm.spike. The object must be a list with the following elements

  • beta: a matrix of MCMC draws, with rows representing draws, and columns representing coefficients.

  • xlevels: the levels of any contrasts present in the original training data.

  • contrasts: the "contrasts" attribute of the original design matrix used to train the model.

  • terms: the terms of the formula used to fit the original model.


A data frame, matrix, or vector containing the predictors needed to make a prediction. If newdata is a matrix it must have the same number of columns as length(object$beta), unless it is off by one and the model contains an intercept, in which case an intercept term will be added. If length(object$beta) == 1 (or 2, with one element containing an intercept) then newdata can be a numeric vector.


A function specifying what to do with NA's.


Extra arguments passed to model.matrix, in the event that newdata is a data frame.


A matrix of predictor variables suitable for multiplication by object$beta.


Steven L. Scott

See Also

lm.spike SpikeSlabPrior plot.lm.spike predict.lm.spike

[Package BoomSpikeSlab version 1.2.6 Index]