Learn R Programming

gmvarkit (version 1.4.1)

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

Description

Forecast GMVAR process defined as a class 'gmvar' object. The forecasts 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 gmvar
predict(
  object,
  ...,
  n_ahead,
  n_simu = 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 'gmvar', generated by function fitGMVAR or GMVAR.

...

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?

n_simu

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 'gmvarpred' 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. 2020. Structural Gaussian mixture vector autoregressive model. Unpublished working paper, available as arXiv:2007.04713.

See Also

GIRF

Examples

Run this code
# NOT RUN {
# These examples use the data 'eurusd' which comes with the
# package, but in a scaled form.
data <- cbind(10*eurusd[,1], 100*eurusd[,2])
colnames(data) <- colnames(eurusd)

# GMVAR(2,2) model
params22 <- c(1.386, -0.767, 1.314, 0.145, 0.094, 1.292, -0.389, -0.07,
 -0.109, -0.281, 0.92, -0.025, 4.839, 0.998, 5.916, 1.248, 0.077, -0.04,
 1.266, -0.272, -0.074, 0.034, -0.313, 5.855, 3.569, 9.837, 0.741)
fit22 <- GMVAR(data, p=2, M=2, params=params22)
p1 <- predict(fit22, n_ahead=10, pred_type="median", n_simu=500)
p1
p2 <- predict(fit22, n_ahead=10, nt=20, lty=1, n_simu=500)
p2
p3 <- predict(fit22, n_ahead=10, pi=c(0.99, 0.90, 0.80, 0.70),
              nt=30, lty=0, n_simu=500)
p3

# Structural GMVAR(2, 2), d=2 model identified with sign-constraints:
params222s <- c(-11.964, 155.024, 11.636, 124.988, 1.314, 0.145, 0.094, 1.292,
 -0.389, -0.07, -0.109, -0.281, 1.248, 0.077, -0.04, 1.266, -0.272, -0.074,
  0.034, -0.313, 0.903, 0.718, -0.324, 2.079, 7.00, 1.44, 0.742)
W_222 <- matrix(c(1, 1, -1, 1), nrow=2, byrow=FALSE)
mod222s <- GMVAR(data, p=2, M=2, params=params222s, parametrization="mean",
 structural_pars=list(W=W_222))
p1 <- predict(mod222s, n_ahead=10, n_simu=500)
# }

Run the code above in your browser using DataLab