altf3 | R Documentation |
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
.
altf3(y,x=NULL,windows,av=NULL,initial.period=NULL,d=NULL,fmod=NULL,parallel=NULL,c=NULL)
y |
|
x |
|
windows |
|
av |
optional, a method for model averaging, |
initial.period |
optional, |
d |
optional, |
fmod |
optional, class |
parallel |
optional, |
c |
optional, see |
For each av
method, in the initial period equal weights for each model are taken, and then successively updated based on the chosen criterion.
class altf3
object, list
of
$summary |
|
$y.hat |
|
$y |
|
$coeff. |
|
$weights |
|
$p.val. |
|
$exp.win. |
|
Pesaran, M. H., Pick, A., 2011. Forecast combination across estimation windows. Journal of Business & Economic Statistics 29, 307–318.
plot.altf3
, print.altf3
, summary.altf3
, roll.reg
, altf
, altf2
, altf4
.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.