altf3 {fDMA} | R 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 |
|
x |
|
windows |
|
av |
optional, a method for model averaging, |
initial.period |
optional, |
d |
optional, |
fmod |
optional, class |
parallel |
optional, |
c |
optional, see |
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 |
|
$y.hat |
|
$y |
|
$coeff. |
|
$weights |
|
$p.val. |
|
$exp.win. |
|
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))