posterior_predict.varstan: Draw from posterior predictive h steps ahead distribution

Description Usage Arguments Value Author(s)

View source: R/posterior_predict.R

Description

The posterior predictive distribution is the distribution of the outcome implied by the model after using the observed data to update our beliefs about the unknown parameters in the model. Simulating data from the posterior predictive distribution using the observed predictors is useful for checking the fit of the model. Drawing from the posterior predictive distribution at interesting values of the predictors also lets us visualize how a manipulation of a predictor affects (a function of) the outcome(s). With new observations of predictor variables we can use the posterior predictive distribution to generate predicted outcomes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'varstan'
posterior_predict(
  object,
  h = 0,
  xreg = NULL,
  robust = FALSE,
  draws = 1000,
  seed = NULL,
  ...
)

Arguments

object

a varstan object

h

An integer indicating the number of predictions. The default number of predictions is 12.

xreg

Optionally, a numerical matrix of external regressors, which must have the same number of rows as ts. It should not be a data frame.

robust

A boolean for obtain the robust estimation. The default

draws

An integer indicating the number of draws to return. The default number of draws is 1000

seed

An optional seed to use.

...

Further arguments passed to posterior_predict.

Value

A draws by h data.frame of simulations from the posterior predictive distribution. Each row of the data.frame is a vector of predictions generated using a single draw of the model parameters from the posterior distribution.

Author(s)

Asael Alonzo Matamoros


bayesforecast documentation built on June 17, 2021, 5:14 p.m.