altf4: Computes a Time-Varying Parameters Rolling Regression...

altf4R Documentation

Computes a Time-Varying Parameters Rolling Regression Averaged over Different Window Sizes.

Description

It is necessary to compare a given forecast method with some alternative ones. This function computes selected forecast quality measures for a time-varying parameters rolling regression averaged over different window sizes (which might be treated as alternative forecasting method to Dynamic Model Averaging, Dynamic Model Selection, etc.). The averaging is performed as in Raftery et al. (2010). The only difference is that the state space of the models are constructed not by chosing different combinations of independent variables, but for a fixed set of independent variables various rolling windows sizes are chosen and models constructed in such a way constitute the state space.

ME (Mean Error), RMSE (Root Mean Squared Error), MAE (Mean Absolute Error), MPE (Mean Percentage Errror) and MAPE (Mean Absolute Percentage Error) are computed as accuracy. HR (Hit Ratio) is computed as hit.ratio.

Usage

altf4(y,x,windows,V=NULL,alpha=NULL,lambda=NULL,initial.period=NULL,
d=NULL,fmod=NULL,parallel=NULL,c=NULL,small.c=NULL)

Arguments

y

numeric or a column matrix of a dependent variable

x

matrix of independent variables, different columns correspond to different independent variables

windows

numeric vector, sizes of a rolling regression windows (numbers of observations)

V

optional, numeric, initial variance in the state space equation for the recursive moment estimator updating method, as in Raftery et al. (2010), if not specified V=1 is taken, see tvp

lambda

optional, numeric, a forgetting factor between 0 and 1 used in variance approximations, if not specified lambda=0.99 is taken, see tvp

alpha

optional, numeric, a forgetting factor \alpha between 0 and 1 used in probabilities estimations, if not specified alpha=0.99 is taken, see fDMA

initial.period

optional, numeric, a number of observation since which forecast quality measures are computed, if not specified the whole sample is used, i.e., initial.period=1

d

optional, logical, a parameter used for HR (Hit Ratio) calculation, should be d=FALSE for level time-series and d=TRUE if time-series represent changes, if not specified d=FALSE

fmod

optional, class dma object, a model to be compared with alternative forecast

parallel

optional, logical, indicate whether parallel computations should be used, by default parallel=FALSE

c

optional, see tvp

small.c

optional, see fDMA

Value

class altf4 object, list of

$summary

matrix of forecast quality measures ordered by columns

$y.hat

list of predicted values from a time-varying parameters rolling regression averaged over selected window sizes

$y

y, forecasted time-series

$coeff.

list of coefficients from a time-varying parameters rolling regression averaged over selected window sizes

$weights

list of weights of models used in averaging

$exp.win.

list of expected window size

References

Pesaran, M. H., Pick, A., 2011. Forecast combination across estimation windows. Journal of Business & Economic Statistics 29, 307–318.

Raftery, A. E., Gneiting, T., Balabdaoui, F., Polakowski, M., 2005. Using Bayesian Model Averaging to calibrate forecast ensembles. Monthly Weather Review 133, 1155–1174.

Raftery, A. E., Karny, M., Ettler, P., 2010. Online prediction under model uncertainty via Dynamic Model Averaging: Application to a cold rolling mill. Technometrics 52, 52–66.

See Also

plot.altf4, print.altf4, summary.altf4, roll.reg, tvp, altf, altf2, altf3.

Examples


wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- (diff(log(drivers)))[-1,]

a1 <- altf4(y=ld.wti,x=ld.drivers,d=TRUE,windows=c(36,100,150))

win <- c(36,100,150)
a2 <- altf4(y=ld.wti,x=ld.drivers,d=TRUE,windows=win,alpha=0.9,lambda=0.95)

# models without a constant term
a3 <- altf4(y=ld.wti,x=ld.drivers,d=TRUE,windows=win,alpha=0.9,lambda=0.95,c=FALSE)

# models only with a constant term
empty <- matrix(,nrow=nrow(ld.drivers),ncol=0)
a4 <- altf4(y=ld.wti,x=empty,d=TRUE,windows=win,alpha=0.9,lambda=0.95)


fDMA documentation built on July 26, 2023, 6:09 p.m.

Related to altf4 in fDMA...