# Dynamic Model Averaging in Economics and Finance with fDMA: A Package for R
## 4 Fundamental Functions
The outcome of fDMA is the object of class dma, i.e., it is a list of:  
* $y.hat: forecasted values,
* $post.incl: relative variable importance for all explanatory variables (also called _posterior inclusion probabilities_), as given by Equation (15),
* $MSE: MSE (Mean Squared Error) of forecast,
* $MAE: MAE (Mean Absolute Error) of forecast,* $models: models included in estimations, i.e., mods.incl; or models used in the last step of dynamic Occam's window method, if this method was used,
* $post.mod: posterior probabilities of all used models, i.e., values given by Equation (2); or NA if dynamic Occam's window method was used,
* $exp.var: the expected number of variables including the constant term, as given by Equation (16),
* $exp.coef: the expected values of regression coefficients, i.e., the weighted average of regression coefficients from all models used in the forecast combination scheme, averaged with the weights given by Equation (2),
* $parameters: parameters of the estimated model,
* $yhat.all.mods: predictions from all single models used in the forecast combination method,
* $y: the dependent variable,
* $benchmarks: RMSE (Root Mean Squared Error) and MAE (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 t, if Dynamic Occam's Window method has been selected,
* $p.dens.: predictive densities from the last period of all models used in estimations of the forecast combination scheme, i.e., \(f_{k}(y_{t}|Y^{t-1})\) as in Equation (2) for all \(k=1,\ldots,K\) from the last period,
* $exp.lambda: the expected values of lambda parameter. This is meaningful only if lambda was specified as numeric vector. Then, as the models are given different weights given by Equation (2) the average value of \(\lambda\) varies in time. For objects of class dma the results can be also easily presented. In particular, print.dma prints the parameters, RMSE (Root Mean Squared Error) and MAE (Mean Absolute Error) from the estimated model. It also shows the number of observations, the number of models used in the forecast combination scheme and the number of variables including constant used. The number of models does not count multiple lambda. The function also shows forecast quality measures for alternative forecasting methods. The function summary.dma produces the outcomes as print.dma. Additionally, for Dynamic Model Averaging (DMA), it shows how often (in comparison to the whole analysed period) a relative variable importance for a given explanatory variable exceeds 0.5. It also shows minimum, maximum and mean relative variable importance for every explanatory variable throughout the analysed period. For Dynamic Model Selection (DMS) and Median Probability Model, it shows how often (in comparison to the whole analysed period) a given variable is present in the selected model. Also, plot.dma is available. Depending on the method used (DMA, DMS or Median Probability Model, and whether dynamic Occam's window was applied) various outcomes can be graphically presented. In particular,  
* actual and predicted values,
* residuals,
* the expected number of variables (including constant),
* relative variable importance for all explanatory variables both on one plot, or in separate png files, saved in the current working directory, and joining them into one big plot, also saved as png file in the current working directory,
* the expected coefficients (including constant) on one plot, or in separate png files, saved in the current working directory, and joining them into one big plot, also saved as png file in the current working directory,
* the expected value of lambda,
* posterior model probabilities, i.e., the ones given by Equation (2),* the number of models used in Dynamic Model Averaging (DMA), if dynamic Occam's window was selected,
* which variables (including constant) were included in DMS or Median Probability Model model each time.