This is a convenience function for computing \(y - y_{h}\)
The method for stanfit objects calls posterior_predict
internally, where as the method accepts the data.frame returned by
posterior_predict as input and can be used to avoid multiple calls to
posterior_predict.
# S3 method for varstan
predictive_error(
object,
newdata = NULL,
xreg = NULL,
draws = 1000,
seed = NULL,
...
)A draws by nrow(newdata) data.frame.
Either a fitted model object returned by one of the rstanarm
modeling functions (a stanreg object) or, for the "ppd" method, a matrix
of draws from the posterior predictive distribution returned by posterior_predict.
An array with the new-data vector.
Optional, a numerical matrix of external regressors, which must have the same number of rows as ts. It should not be a data frame.
Optional arguments passed to posterior_predict.
Please see the Note section below if newdata will be specified.
Further arguments passed to predictive_error.
posterior_predict function from rstanarm package, to draw
from the posterior predictive distribution without computing predictive errors.