Learn R Programming

LaMa (version 3.1.0)

pred_matrix: Build the prediction design matrix based on new data and model_matrices object created by modmat

Description

Deprecated. Use predict on the object returned by modmat instead, which does the same thing: predict(modmat, newdata) in place of pred_matrix(modmat, newdata).

Usage

pred_matrix(model_matrices, newdata, what = NULL, exclude = NULL)

Value

prediction design matrix for newdata with the same basis as used for model_matrices

Arguments

model_matrices

model_matrices object as returned from modmat

newdata

data frame containing the variables in the formula and new data for which to evaluate the basis

what

optional character string specifying which formula to use for prediction if model_matrices contains multiple formulas.

exclude

optional vector of terms to set to zero in the predicted design matrix. Useful for predicting main effects only when e.g. s(..., bs = "re") terms are present. See mgcv::predict.gam for more details.

See Also

predict, which replaces this function

Examples

Run this code
modmat = modmat(~ s(x), data.frame(x = 1:10))
# deprecated:
# Z_p = pred_matrix(modmat, data.frame(x = 1:10 - 0.5))
# use instead:
Z_p = predict(modmat, data.frame(x = 1:10 - 0.5))

Run the code above in your browser using DataLab