AFTER1: Forecast combination by AFTER.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/AFTER1.R

Description

This function generates forecast combination results using the AFTER algorithm (Yang, 2004).

Usage

1
AFTER1(X, y, Xnew, ynew = NULL, n0 = 5)

Arguments

X

Matrix of candidate forecasts for observed series.

y

Observed series.

Xnew

Matrix of candidate forecasts for unobserved series.

ynew

(Optional) True values of unobserved series, usually supplied for testing forecast accurary. If ynew is given, a forecast from Xnew can use previous observations in ynew as in any real forecasting scenarios.

n0

Number of “burn-in” observations for AFTER.

Details

This function generates forecasts from the AFTER algorithm. For detailed updating scheme, see Yang (2004).

Value

It returns a list that contains combined forecasts (both fitted values from X and prediction from Xnew):

fcst

a forecast matrix, with first column being forecasts from L1-AFTER and second column from L2-AFTER.

L1Wt

weight matrix used for L1-AFTER.

L2Wt

weight matrix used for L2-AFTER.

Author(s)

Wei Qian, Craig A. Rolling, Gang Cheng and Yuhong Yang
Maintainer: Wei Qian <weiqian@udel.edu>

References

Yang, Y. (2004), “Combining Forecasting Procedures: Some Theoretical Results,” Econometric Theory, 20, 175-222.

Qian, W., Rolling, C. A., Cheng, G., and Yang, Y. (2021), “Combining Forecasts for Universally Optimal Performance”, International Journal of Forecasting, to appear.

See Also

AIafter.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(AIafter)
data(rgdp)


# observed series and its candidate forecasts
neval <- 20
n <- nrow(rgdp)
y <- rgdp[1:(n-neval),1]
X <- rgdp[1:(n-neval),-1]
# candidate forecasts for unobserved series
Xnew <- rgdp[(n-neval+1):n,-1]

# generate forecasts by AFTER (both fitted and predicted values)
fcst <- AFTER1(X,y,Xnew)

# true values of unobserved series
ynew <- rgdp[(n-neval+1):n,1]
# generate forecasts by AFTER (usually used for evaluation of forecast accuracy)
fcst <- AFTER1(X,y,Xnew,ynew)

weiqian1/AIafter documentation built on Dec. 23, 2021, 5:10 p.m.