Learn R Programming

LaMa (version 2.0.4)

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

Description

Build the prediction design matrix based on new data and model_matrices object created by make_matrices

Usage

pred_matrix(model_matrices, newdata, 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 make_matrices

newdata

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

exclude

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

Examples

Run this code
modmat = make_matrices(~ s(x), data.frame(x = 1:10))
Z_predict = pred_matrix(modmat, data.frame(x = 1:10 - 0.5))

Run the code above in your browser using DataLab