DMA: Perform Dynamic Model Averaging

Description Usage Arguments Details Value Author(s) References Examples

View source: R/Estimate.R

Description

Implements the Dynamic Model Averaging procedure with the possibility of also performing averaging over a grid of foregetting factor values

Usage

1
2
3
DMA(formula, data, vDelta = c(0.9, 0.95, 0.99), dAlpha = 0.99,
    vKeep = NULL, bZellnerPrior = FALSE, dG = 100, bParallelize = TRUE,
    iCores = NULL, dBeta = 1.0)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

an object of the class data.frame, (or object coercible by as.data.frame to a data frame) containing the variables in the model. It can also be an object of the classes ts, xts or zoo. If this is the case, the time information is used in the graphical representation of the results. The last observation of the dependent variable can be equal to NA. This is the case when a series of length T is available but the user wants to have predictions for time T+1, see Details.

vDelta

D x 1 numeric vector representing the the grid of values of δ. By default vDelta = c(0.9, 0.95, 0.99).

dAlpha

numeric variable representing α. By default dAlpha = 0.99.

vKeep

numeric vector of indices representing the predictors that must be always included in the models. The combinations of predictors that do not include the variables declared in vKeep are automatically discarded. The indices must be consistent with the model description given in formula, i.e., if the first and the fourth variables always have to be included, then we must set vKeep=c(1, 4). Note that, the intercept (if not removed from formula) is always in the first position. It can also be a character vector indicating the names of the predictors if these are consistent with the provided formula. If vKeep = "KS" the "Kitchen Sink" formulation is adopted, i.e., all the predictors are always included, see, e.g., Paye (2012). By default all the combinations are considered, i.e. vKeep = NULL.

bZellnerPrior

Boolean variable indicating whether the Zellner prior should be used on the coefficients at time t=0. Default = FALSE.

dG

numeric variable equal to 100 by default. If bZellnerPrior = TRUE this represent the variable 'g' in Eq. (4) of Dangl Halling (2012). Otherwise, if bZellnerPrior = FALSE it represents the scaling factor for the variance covariance matrix of the normal prior for θ_0, i.e. θ_0~N(0,dG*I) where I is the identity matrix.

bParallelize

Boolean variable indicating whether to use multiple processors to speed up the computations. By default bParallelize = TRUE.

iCores

integer indicating the number of cores to use if bParallelize = TRUE. By default all but one cores are used. The number of cores is guessed using the detectCores() function from the parallel package.

dBeta

integer indicating the forgetting factor for the measurement variance, see Prado and West (2010) pp. 132 and Beckmann and Schussler (2014).

Details

There might be situations when the practitioner desires to predict T+1 conditional on observation till time T in a true out-of-sample fashion. In such circumstances the user can substitute the future value of the dependent variable with an NA. This way, the code treats the last observation as missing and does not perform backtesting or updating of the coefficients. However, the filter provides us with the necessary quantities to perform prediction. The predicted value \hat{y_{T+1}} = E[y_T+1 | F_T] as well as the predicted variance decomposition can then be extracted using the getLastForecast method. The other quantities that can be extracted, for example via the as.data.frame method, will ignore the presence of the last NA and report results only for the fist T observations.

See Catania and Nonejad (2016) for further details.

Value

An object of the class DMA, see DMA-class.

Author(s)

Leopoldo Catania & Nima Nonejad

References

Beckmann, J., & Schussler, R. (2014). Forecasting Equity Premia using Bayesian Dynamic Model Averaging (No. 2914). Center for Quantitative Economics (CQE), University of Muenster.

Dangl, T., & Halling, M. (2012). Predictive regressions with time–varying coefficients. Journal of Financial Economics, 106(1), 157–181. doi: 10.1016/j.jfineco.2012.04.003.

Catania, Leopoldo, and Nima Nonejad. "Dynamic Model Averaging for Practitioners in Economics and Finance: The eDMA Package." arXiv preprint arXiv:1606.05656 (2016).

Paye, B.S. (2012). 'Deja vol': Predictive Regressions for Aggregate Stock Market Volatility Using Macroeconomic Variables.Journal of Financial Economics, 106(3), 527-546. ISSN 0304-405X. doi: 10.1016/j.jfineco.2012.06.005. URL http://www.sciencedirect.com/science/article/pii/S0304405X12001316.

Prado, R., & West, M. (2010). Time series: modeling, computation, and inference. CRC Press.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
#  Code chunk of Catania and Nonejad (2016) Fast Dynamic Model Averaging
#  for Practitioners in Economics and Finance: The eDMA Package
library(eDMA)

## load data
data("USData")

## do DMA, keep the first three predictors fixed and the intercept
Fit <- DMA(GDPDEF ~ Lag(GDPDEF, 1) + Lag(GDPDEF, 2) + Lag(GDPDEF, 3) +
            Lag(ROUTP, 1) + Lag(UNEMP, 1), data = USData, vDelta = c(0.9,0.95,0.99),
             vKeep = c(1, 2, 3, 4))

Fit

## End(Not run)

eDMA documentation built on May 29, 2017, 5:37 p.m.