| predict.LaMa_matrices | R Documentation |
make_matricesBuild the prediction design matrix based on new data and model_matrices object created by make_matrices
## S3 method for class 'LaMa_matrices'
predict(object, newdata, what = NULL, ...)
object |
model matrices object as returned from |
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 |
... |
needs to be a |
prediction design matrix for newdata with the same basis as used for model_matrices
make_matrices for creating objects of class LaMa_matrices which can be used for prediction by this function.
# single formula
modmat = make_matrices(~ s(x), data.frame(x = 1:10))
Z_p = predict(modmat, data.frame(x = 1:10 - 0.5))
# with multiple formulas
modmat = make_matrices(list(mu ~ s(x), sigma ~ s(x, bs = "ps")), data = data.frame(x = 1:10))
Z_p = predict(modmat, data.frame(x = 1:10 - 0.5), what = "mu")
# nested formula list
form = list(stream1 = list(mu ~ s(x), sigma ~ s(x, bs = "ps")))
modmat = make_matrices(form, data = data.frame(x = 1:10))
Z_p = predict(modmat, data.frame(x = 1:10 - 0.5), what = c("stream1", "mu"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.