posterior_epred.varstan: Expected Values of the Posterior Predictive Distribution

Description Usage Arguments Value

View source: R/posterior_predict.R

Description

Compute posterior samples of the expected value/mean of the posterior predictive distribution. Can be performed for the data used to fit the model (posterior predictive checks) or for new data. By definition, these predictions have smaller variance than the posterior predictions performed by the posterior_predict.varstan method. This is because only the uncertainty in the mean is incorporated in the samples computed by posterior_epred while any residual error is ignored. However, the estimated means of both methods averaged across samples should be very similar.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'varstan'
posterior_epred(
  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

An array of predicted mean response values. For categorical and ordinal models, the output is an S x N x C array. Otherwise, the output is an S x N matrix, where S is the number of posterior samples, N is the number of observations, and C is the number of categories. In multivariate models, an additional dimension is added to the output which indexes along the different response variables.


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