predict.mbm: Predict method for MBM objects

Description Usage Arguments Details Value

View source: R/predict_mbm.r

Description

Predict method for MBM objects

Usage

1
2
## S3 method for class 'mbm'
predict(x, newdata, type = c("link", "response"))

Arguments

x

A previously-fit MBM object

newdata

Optional dataset for prediction. If present, it should be a new dataset in the same format used to fit the model (i.e., a site by covariate matrix). If missing, predictions will be for the original data.

type

Whether to return predictions on the link or response scale

n_samples

NA or integer; if NA, analytical predictions with standard deviation are returned, otherwise posterior samples are returned.

Details

Prediction to new data is possible after the fact for mbm models, however there can be performance penalties for doing so with large models. Thus, it is sometimes preferable to predict during model fitting via the predictX argument to the mbm function.

All prediction is done on the link scale.

This function caches to disk, thus it is important to ensure that adequate disk space is available when using large prediction datasets.

Value

A data frame of predictions and standard deviations (on the link scale); use x$y_rev_transform(x$rev_link(predictions$fit)) for the response scale.


mtalluto/mbmtools documentation built on Aug. 13, 2019, 9:44 a.m.