predict.gsmvar: Predict method for class 'gsmvar' objects

View source: R/predictMethod.R

predict.gsmvarR Documentation

Predict method for class 'gsmvar' objects

Description

predict.gsmvar is a predict method for class 'gsmvar' objects. The forecasts of the GMVAR, StMVAR, and G-StMVAR models are computed by performing independent simulations and using the sample medians or means as point forecasts and empirical quantiles as prediction intervals. For one-step-ahead predictions using the exact conditional mean is also supported.

Usage

## S3 method for class 'gsmvar'
predict(
  object,
  ...,
  n_ahead,
  nsim = 2000,
  pi = c(0.95, 0.8),
  pi_type = c("two-sided", "upper", "lower", "none"),
  pred_type = c("median", "mean", "cond_mean"),
  plot_res = TRUE,
  mix_weights = TRUE,
  nt
)

Arguments

object

an object of class 'gsmvar', typically created with fitGSMVAR or GSMVAR.

...

additional arguments passed to grid (ignored if plot_res==FALSE) which plots grid to the figure.

n_ahead

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.

pi_type

should the prediction intervals be "two-sided", "upper", or "lower"?

pred_type

should the prediction be based on sample "median" or "mean"? Or should it be one-step-ahead forecast based on the exact conditional mean ("cond_mean")? Prediction intervals won't be calculated if the exact conditional mean is used.

plot_res

should the results be plotted?

mix_weights

TRUE if forecasts for mixing weights should be plotted, FALSE in not.

nt

a positive integer specifying the number of observations to be plotted along with the prediction (ignored if plot_res==FALSE). Default is round(nrow(data)*0.15).

Value

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

$pred

Point forecasts

$pred_int

Prediction intervals, as [, , d].

$mix_pred

Point forecasts for the mixing weights

mix_pred_int

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

References

  • Kalliovirta L., Meitz M. and Saikkonen P. 2016. Gaussian mixture vector autoregression. Journal of Econometrics, 192, 485-498.

  • Virolainen S. (forthcoming). A statistically identified structural vector autoregression with endogenously switching volatility regime. Journal of Business & Economic Statistics.

  • Virolainen S. 2022. Gaussian and Student's t mixture vector autoregressive model with application to the asymmetric effects of monetary policy shocks in the Euro area. Unpublished working paper, available as arXiv:2109.13648.

@keywords internal

See Also

GIRF, GFEVD, simulate.gsmvar

Examples

# GMVAR(2, 2), d=2 model
params22 <- c(0.36, 0.121, 0.223, 0.059, -0.151, 0.395, 0.406, -0.005,
 0.083, 0.299, 0.215, 0.002, 0.03, 0.484, 0.072, 0.218, 0.02, -0.119,
  0.722, 0.093, 0.032, 0.044, 0.191, 1.101, -0.004, 0.105, 0.58)
mod22 <- GSMVAR(gdpdef, p=2, M=2, d=2, params=params22)
p1 <- predict(mod22, n_ahead=10, pred_type="median", nsim=500)
p1
p2 <- predict(mod22, n_ahead=10, nt=20, lty=1, nsim=500)
p2
p3 <- predict(mod22, n_ahead=10, pi=c(0.99, 0.90, 0.80, 0.70),
              nt=30, lty=0, nsim=500)
p3

# StMVAR(2, 2), d=2 model
params22t <- c(0.36, 0.121, 0.223, 0.059, -0.151, 0.395, 0.406, -0.005,
 0.083, 0.299, 0.215, 0.002, 0.03, 0.484, 0.072, 0.218, 0.02, -0.119,
  0.722, 0.093, 0.032, 0.044, 0.191, 1.101, -0.004, 0.105, 0.58, 3, 4)
mod22t <- GSMVAR(gdpdef, p=2, M=2, d=2, params=params22t, model="StMVAR")
p1 <- predict(mod22t, n_ahead=12, pred_type="median", nsim=500, pi=0.9)
p1

saviviro/gmvarkit documentation built on March 8, 2024, 4:15 a.m.