Learn R Programming

GAS (version 0.3.4.1)

UniGASFor: Forecast with univariate GAS models

Description

Forecast with univariate GAS models. The one-step ahead prediction of the conditional density is available in closed form. The multi-step ahead prediction is performed by simulation as detailed in Blasques et al. (2016).

Usage

UniGASFor(uGASFit, H = NULL, Roll = FALSE, out = NULL, B = 10000,
                     Bands = c(0.1, 0.15, 0.85, 0.9), ReturnDraws = FALSE)

Value

An object of the class uGASFor.

Arguments

uGASFit

An object of the class uGASFit created using the function UniGASFit.

H

numeric Forecast horizon. Ignored if Roll = TRUE.

Roll

logical Forecast should be made using a rolling procedure ? Note that, if Roll = TRUE, then out has to be specified.

out

numeric Vector of out-of-sample observation for rolling forecast.

B

numeric Number of draws from the H-step ahead distribution if Roll = FALSE.

Bands

numeric Vector of probabilities representing the confidence band levels for multi-step ahead parameters forecasts. Only if Roll = FALSE.

ReturnDraws

logical Return the draws from the multi-step ahead predictive distribution when Roll = FALSE ?

Author

Leopoldo Catania

References

Blasques F, Koopman SJ, Lasak K, and Lucas, A (2016). "In-sample Confidence Bands and Out-of-Sample Forecast Bands for Time-Varying Parameters in Observation-Driven Models." International Journal of Forecasting, 32(3), 875-887. tools:::Rd_expr_doi("10.1016/j.ijforecast.2016.04.002").

Examples

Run this code
# Specify an univariate GAS model with Student-t
# conditional distribution and time-varying location, scale and shape parameter

# Inflation Forecast

set.seed(123)

data("cpichg")

GASSpec = UniGASSpec(Dist = "std", ScalingType = "Identity",
                     GASPar = list(location = TRUE, scale = TRUE, shape = FALSE))

# Perform H-step ahead forecast with confidence bands

Fit = UniGASFit(GASSpec, cpichg)
Forecast = UniGASFor(Fit, H = 12)

Forecast

# Perform 1-Step ahead rolling forecast

InsampleData = cpichg[1:250]
OutSampleData = cpichg[251:276]

Fit = UniGASFit(GASSpec, InsampleData)

Forecast = UniGASFor(Fit, Roll = TRUE, out = OutSampleData)

Forecast

Run the code above in your browser using DataLab