predict: Model Prediction

predict.arima.estimateR Documentation

Model Prediction

Description

Prediction function for class “arima.estimate” or “bsts.estimate”.

Usage

## S3 method for class 'arima.estimate'
predict(
  object,
  h = NULL,
  newxreg = NULL,
  nsim = 5000,
  forc_dates = NULL,
  bootstrap = FALSE,
  innov = NULL,
  ...
)

## S3 method for class 'bsts.estimate'
predict(
  object,
  h = 1,
  newxreg = NULL,
  forc_dates = NULL,
  init_states = colMeans(bsts_final_state(object)),
  posterior_means = NULL,
  innov = NULL,
  burn = NULL,
  ...
)

Arguments

object

an object of class “arima.estimate” or “bsts.estimate”.

h

the forecast horizon.

newxreg

a matrix of external regressors in the forecast horizon.

nsim

The number of simulations to use for generating the simulated predictive distribution. For the bsts model, this is equal to the number of MCMC samples generated during estimation, less any burn-in draws.

forc_dates

an optional vector of forecast dates equal to h. If NULL will use the implied periodicity of the data to generate a regular sequence of dates after the last available date in the data.

bootstrap

for the arima model whether to bootstrap the residuals.

innov

for the bsts and arima models this is an optional vector of uniform innovations which will be translated to regular innovations using the appropriate distribution quantile function and model standard deviation. The length of this vector should be equal to nsim x horizon for the arima model and MCMC draws (less burn) x horizon for the bsts model. Burn is equal to SuggestBurn(0.1, object$model) for the bsts model.

...

not currently used.

init_states

an optional named vector which will re-center distribution of the final state from which predictions are based off. It is best to call bsts_final_state function in order to get the full matrix and make any changes to the state_means prior to submitting to the function. It is required that the full vector is provided and minimal checks other than length are performed.

posterior_means

optional vector of posterior parameter means which are then use to re-center the posterior parameters. In the case of AR and regressor coefficients, these should represent the means of the non-zero values (since both of these types of parameters are based on a spike and slab prior). The posterior distribution of the parameters can be obtain by calling bsts_posterior.

burn

optional scalar denoting the numbers of draws to burn from the posterior prior to prediction.

Value

An object which inherits class “tsmodel.predict” with slots for the simulated or posterior predictive distribution, the original series (as a zoo object), the original specification object and the mean forecast. The predictive distribution is inversed difference (if differencing > 0) and back transformed if lambda was not NULL in the original specification. The innov argument for bsts is unlikely to be useful for ensembling, as has been done for other models with a single source of error as a result of multiple source of errors which disables our ability to infuse the required dependence structure via this approach.


tsmodels/tsforeign documentation built on June 22, 2022, 2:09 p.m.