altf3: Computes a Rolling Regression Averaged over Different Window...

altf3R Documentation

Computes a 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 rolling regression averaged over different window sizes (which might be treated as alternative forecasting method to Dynamic Model Averaging, Dynamic Model Selection, etc.).

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

altf3(y,x=NULL,windows,av=NULL,initial.period=NULL,d=NULL,fmod=NULL,parallel=NULL,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, if not specified only constant term will be included

windows

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

av

optional, a method for model averaging, av="ord" corresponds to equal weights for each model, av="aic" corresponds to information theoretic model averaging based on Akaike Information Criterion, av="aicc" corresponds to information theoretic model averaging based on Akaike Information Criterion with a correction for finite sample sizes, av="bic" corresponds to information theoretic model averaging based on Bayesian Information Criterion, av="mse" corresponds to setting weights proportional to the inverse of the models Mean Squared Error, if av is numeric then weights are computed proportional to the av-th power of window size, if not specified av="ord" is used

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 roll.reg

Details

For each av method, in the initial period equal weights for each model are taken, and then successively updated based on the chosen criterion.

Value

class altf3 object, list of

$summary

matrix of forecast quality measures ordered by columns

$y.hat

list of predicted values from a rolling regression averaged over selected window sizes

$y

y, forecasted time-series

$coeff.

list of coefficients from a rolling regression averaged over selected window sizes

$weights

list of weights of models used in averaging

$p.val.

list of p-values (averaged over selected window sizes) for t-test of statistical significance for coefficients from a rolling regression

$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.

See Also

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

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 <- altf3(y=ld.wti,x=ld.drivers,d=TRUE,windows=c(36,100,150))

a2 <- altf3(y=ld.wti,x=ld.drivers,d=TRUE,av="aic",windows=c(36,100,150))

a3 <- altf3(y=ld.wti,x=ld.drivers,d=TRUE,av=-2,windows=c(36,100,150))

# models without a constant term 
a4 <- altf3(y=ld.wti,x=ld.drivers,d=TRUE,av=-2,windows=c(36,100,150),c=FALSE)

# models only with a constant term
a5 <- altf3(y=ld.wti,d=TRUE,av=-2,windows=c(36,100,150))


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

Related to altf3 in fDMA...