altf4 | R Documentation |
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
.
altf4(y,x,windows,V=NULL,alpha=NULL,lambda=NULL,initial.period=NULL,
d=NULL,fmod=NULL,parallel=NULL,c=NULL,small.c=NULL)
y |
|
x |
|
windows |
|
V |
optional, |
lambda |
optional, |
alpha |
optional, |
initial.period |
optional, |
d |
optional, |
fmod |
optional, class |
parallel |
optional, |
c |
optional, see |
small.c |
optional, see |
class altf4
object, list
of
$summary |
|
$y.hat |
|
$y |
|
$coeff. |
|
$weights |
|
$exp.win. |
|
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.
plot.altf4
, print.altf4
, summary.altf4
, roll.reg
, tvp
, altf
, altf2
, altf3
.
wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- drivers[-1,]
ld.drivers[,c(4,6)] <- (diff(drivers[,c(4,6)]))[-1,]
ld.drivers[,c(1:2,5,7)] <- (diff(log(drivers[,c(1:2,5,7)])))[-1,]
ld.drivers[,c(3,6)] <- ld.drivers[,c(3,6)]/100
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.