altf2 {fDMA} | R Documentation |
Computes a Few Alternative Forecasts Based on Model Averaging.
Description
It is necessary to compare a given forecast method with some alternative ones. This function computes selected forecast quality measures for a few selected forecast methods (which might be treated as alternative ones 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
altf2(y,x,mods.incl=NULL,gprob=NULL,omega=NULL,av=NULL,window=NULL,
initial.period=NULL,d=NULL,f=NULL,fmod=NULL,parallel=NULL)
Arguments
y |
|
x |
|
mods.incl |
optional, |
gprob |
optional, |
omega |
optional, |
av |
optional, a method for model averaging, |
window |
optional, |
initial.period |
optional, |
d |
optional, |
f |
optional, |
fmod |
optional, class |
parallel |
optional, |
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. For OLS models weights are not updated. The same weight for each model (estimated from the in-sample period) is taken for each period.
If gprob
is used, then for OLS mean values from the in-sample period are taken, for rec. OLS – mean values from periods up to the current one, for roll. OLS – mean values from the last window
periods, and for TVP – values from the current period.
Value
class altf2
object, list
of
$summary |
|
$y.hat |
|
$y |
|
$coeff. |
|
$weights |
|
$p.val. |
|
$rel.var.imp. |
|
$exp.var. |
|
References
Burnham, K. P., Anderson, D. R., 2004. Multimodel inference: Understanding AIC and BIC in model selection. Sociological Methods & Research 33, 261–304.
Burnham, K. P., Anderson, D. R., 2002. Model Selection and Multimodel Inference: A Practical Information-Theoretic Approach, Springer.
Gelman, A., Hwang, J., Vehtari, A., 2014. Understanding predictive information criteria for Bayesian models. Statistics and Computing 24, 997–1016.
Kapetanios, G., Labhard, V., Price, S., 2008. Forecasting using Bayesian and information-theoretic model averaging. Journal of Business & Economic Statistics 26, 33–41.
Koop, G., Onorante, L., 2014. Macroeconomic nowcasting using Google probabilities. https://goo.gl/ATsBN9
Timmermann, A., 2006. Forecast combinations. In: Elliott, G., et al. (eds.), Handbook of Economic Forecasting, Elsevier.
See Also
plot.altf2
, print.altf2
, summary.altf2
, rec.reg
, roll.reg
, tvp
, altf
, altf3
, 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 <- altf2(y=ld.wti,x=ld.drivers,d=TRUE,initial.period=60)
# compute just selected models
fcomp <- c(TRUE,TRUE,TRUE,FALSE)
a2 <- altf2(y=ld.wti,x=ld.drivers,d=TRUE,f=fcomp,initial.period=60)
a3 <- altf2(y=ld.wti,x=ld.drivers,d=TRUE,f=fcomp,av="aic",initial.period=60)
m1 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10)
a4 <- altf2(y=ld.wti,x=ld.drivers,d=TRUE,f=fcomp,fmod=m1,initial.period=60)
# models just with one independent variable and a constant will be averaged
mds <- diag(1,ncol(ld.drivers),ncol(ld.drivers))
mds <- cbind(rep(1,ncol(ld.drivers)),mds)
a5 <- altf2(y=ld.wti,x=ld.drivers,d=TRUE,mods.incl=mds,initial.period=60)
# Google trends are available since 2004
gp <- trends/100
s1 <- ld.wti['2004-01-01/']
s2 <- ld.drivers['2004-01-01/']
a6 <- altf2(y=s1,x=s2,d=TRUE,gprob=gp,omega=0.5,initial.period=60)