fDMA {fDMA} | R Documentation |
Computes Dynamic Model Averaging.
Description
The function estimates Dynamic Model Averaging (and some of its variations). The method is described in Raftery et al. (2010).
Usage
fDMA(y,x,alpha,lambda,initvar,W=NULL,initial.period=NULL,V.meth=NULL,kappa=NULL,
gprob=NULL,omega=NULL,model=NULL,parallel=NULL,m.prior=NULL,mods.incl=NULL,
DOW=NULL,DOW.nmods=NULL,DOW.type=NULL,DOW.limit.nmods=NULL,progress.info=NULL,
forced.models=NULL,forbidden.models=NULL,forced.variables=NULL,bm=NULL,
small.c=NULL,fcores=NULL,mods.check=NULL,red.size=NULL,av=NULL)
Arguments
y |
|
x |
|
alpha |
|
lambda |
|
initvar |
|
W |
optional, a method for setting the initial values of variance for the models equations, |
initial.period |
optional, |
V.meth |
optional, a method for the state space equation variance updating, |
kappa |
optional, |
gprob |
optional, |
omega |
optional, |
model |
optional, |
parallel |
optional, |
m.prior |
optional, |
mods.incl |
optional, |
DOW |
optional, |
DOW.nmods |
optional, |
DOW.type |
optional, |
DOW.limit.nmods |
optional, |
progress.info |
optional, |
forced.models |
optional, |
forbidden.models |
optional, |
forced.variables |
optional, |
bm |
optional, |
small.c |
optional, |
fcores |
optional, |
mods.check |
optional, |
red.size |
optional, |
av |
optional, |
Details
It is possible to use numeric
vector
for lambda
. Its values are automatically ordered in descending order and if numbers are not unique they are reduced to become unique. If more than one value is given for lambda
, then model state space, i.e., mods.incl
, is expanded by considering all these models with given values of lambda
. The outcomes are then ordered by columns in a way that first outcomes from models with first value of lambda
are presented, then from models with second value of lambda
, etc. (Raftery et al., 2010).
If nrow(gprob)<length(y)
, then the method by Koop and Onorante (2014) is used for the last nrow(gprob)
observations. For the preceding ones the original method by Raftery et al. (2010) is used. In such case a warning
is generated.
Value
class dma
object, list
of
$y.hat |
forecasted values |
$post.incl |
posterior inclusion probabilities for independent variables |
$MSE |
Mean Squared Error of forecast |
$MAE |
Mean Absolute Error of forecast |
$models |
models included in estimations, or models used in the last step of Dynamic Occam's Window method (if this method has been selected) |
$post.mod |
posterior probabilities of all used models, or NA if Dynamic Occam's Window method has been selected |
$exp.var |
expected number of variables (incl. constant) |
$exp.coef. |
expected values of regression coefficients |
$parameters |
parameters of the estimated model |
$yhat.all.mods |
predictions from every sub-model used in estimations |
$y |
|
$benchmarks |
Root Mean Squared Error and Mean Absolute Error of naive and auto ARIMA forecast |
$DOW.init.mods |
models initially selected to Dynamic Occam's Window, if this method has been selected |
$DOW.n.mods.t |
number of models used in Dynamic Model Averaging at time |
$p.dens. |
predicitive densities from the last period of all sub-models used in estimations |
$exp.lambda |
expected values of |
Source
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.
References
Barbieri, M. M., Berger, J. O., 2004. Optimal predictive model selection. The Annals of Statistics 32, 870–897.
Eicher, T. S., Papageorgiou, C., Raftery, A. E., 2011. Default priors and predictive performance in Bayesian Model Averaging, with application to growth determinants. Journal of Applied Econometrics 26, 30–55.
Koop, G., Korobilis, D., 2012. Forecasting inflation using Dynamic Model Averaging. International Economic Review 53, 867–886.
Koop, G., Korobilis, D., 2018. Variational Bayes inference in high-dimensional time-varying parameter models. https://arxiv.org/pdf/1809.03031
Koop, G., Onorante, L., 2014. Macroeconomic nowcasting using Google probabilities. https://goo.gl/ATsBN9
Mitchell, T. J., Beauchamp, J. J., 1988. Bayesian variable selection in linear regression (with discussion). Journal of the American Statistical Association 83, 1023–1036.
Onorante, L., Raftery, A. E., 2016. Dynamic model averaging in large model spaces using dynamic Occam's window. European Economic Review 81, 2–14.
Yin, X., Peng, J., Tang, T., 2018. Improving the forecasting accuracy of crude oil prices. Sustainability 10, 454. doi: 10.3390/su10020454
See Also
grid.DMA
, print.dma
, summary.dma
, plot.dma
, hit.ratio
.
Examples
wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- (diff(log(drivers)))[-1,]
m1 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10)
m2 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,model="dms")
m3 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,V.meth="ewma",kappa=0.9)
m4 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,DOW=0.7)
# Google trends are available since 2004
gp <- trends/100
s <- ld.drivers['2004-01-01/']
m5 <- fDMA(y=ld.wti['2004-01-01/'],x=s,alpha=0.99,lambda=0.90,initvar=10,gprob=gp,omega=0.5)
# 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)
m6 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,mods.incl=mds)
# models just with one independent variable (without a constant) will be averaged
mds.nc <- diag(1,ncol(ld.drivers),ncol(ld.drivers))
mds.nc <- cbind(rep(0,ncol(ld.drivers)),mds.nc)
m7 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.90,initvar=10,mods.incl=mds.nc)
# model with multiple lambda
m8 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=c(0.99,0.95,0.90),initvar=10)