plot.stvarpred {sstvars}R Documentation

Predict method for class 'stvar' objects

Description

predict.stvar is a predict method for class 'stvar' objects.

Usage

## S3 method for class 'stvarpred'
plot(x, ..., nt, trans_weights = TRUE)

## S3 method for class 'stvar'
predict(
  object,
  ...,
  nsteps,
  nsim = 1000,
  pi = c(0.95, 0.8),
  pred_type = c("mean", "median"),
  exo_weights = NULL
)

## S3 method for class 'stvarpred'
print(x, ..., digits = 2)

Arguments

x

object of class 'stvarpred'

...

currently not used.

nt

a positive integer specifying the number of observations to be plotted along with the forecast.

trans_weights

should forecasts for transition weights be plotted?

object

an object of class 'stvar'.

nsteps

how many steps ahead should be predicted?

nsim

to how many independent simulations should the forecast be based on?

pi

a numeric vector specifying the confidence levels of the prediction intervals.

pred_type

should the pointforecast be based on sample "median" or "mean"?

exo_weights

if weight_function="exogenous", provide a size (nsteps x M) matrix of exogenous transition weights for the regimes: [step, m] for step steps ahead and regime m weight. Ignored if weight_function!="exogenous".

digits

the number of decimals to print

Details

The forecasts are computed by simulating multiple sample paths of the future observations and using the sample medians or means as point forecasts and empirical quantiles as prediction intervals.

Value

Returns a class 'stvarpred' object containing, among the specifications,...

$pred

Point forecasts

$pred_ints

Prediction intervals, as [, , d].

$trans_pred

Point forecasts for the transition weights

$trans_pred_ints

Individual prediction intervals for transition weights, as [, , m], m=1,..,M.

Functions

References

See Also

simulate.stvar

Examples

 # p=2, M=2, d=2, Gaussian relative dens weights
 theta_222relg <- c(0.356914, 0.107436, 0.356386, 0.08633, 0.13996, 0.035172,
   -0.164575, 0.386816, 0.451675, 0.013086, 0.227882, 0.336084, 0.239257, 0.024173,
   -0.021209, 0.707502, 0.063322, 0.027287, 0.009182, 0.197066, 0.205831, 0.005157,
   0.025877, 1.092094, -0.009327, 0.116449, 0.592446)
 mod222relg <- STVAR(data=gdpdef, p=2, M=2, d=2, params=theta_222relg,
   weight_function="relative_dens")

 # Predict 10 steps ahead, point forecast based on the conditional
 # mean and 90% prediction intervals; prediction based on 100 sample paths:
 pred1 <- predict(mod222relg, nsteps=10, nsim=100, pi=0.9, pred_type="mean")
 pred1
 plot(pred1)

 # Predict 7 steps ahead, point forecast based on median and  90%, 80%,
 # and 70% prediction intervals; prediction based on 80 sample paths:
 pred2 <- predict(mod222relg, nsteps=7, nsim=80, pi=c(0.9, 0.8, 0.7),
  pred_type="median")
 pred2
 plot(pred2)

[Package sstvars version 1.0.1 Index]