Description Usage Arguments Value Note See Also
View source: R/predictive_error.R
This is a convenience function for computing y - yh
The method for stanreg 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
.
1 2 3 4 5 6 7 8 9 | ## S3 method for class 'varstan'
predictive_error(
object,
newdata = NULL,
xreg = NULL,
draws = 1000,
seed = NULL,
...
)
|
object |
Either a fitted model object returned by one of the rstanarm
modeling functions (a stanreg object) or, for the |
newdata |
An array with the newdata vector. |
xreg |
Optional, a numerical matrix of external regressors, which must have the same number of rows as ts. It should not be a data frame. |
draws, seed |
Optional arguments passed to |
... |
Further arguments passed to |
A draws
by nrow(newdata)
data.frame.
If object
is a varstan object of a varma model then newdata has to be a matrix
with number of cols as the dimension of the time series and number of rows
as the number new elements.
If object
is a posterior_predict
data.frame, then the
length of newdata
has to be equal to the ncol
of object
.
If object
is a posterior_predict
data.frame, for a varma model,
then the dimension product of newdata
matrix has to be equal to
the ncol
of object
.
posterior_predict
function from rstanarm package, to draw
from the posterior predictive distribution without computing predictive
errors.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.