# Dynamic Model Averaging in Economics and Finance with fDMA: A Package for R
## 6 Alternative Forecasts
: a list of coefficients from all forecasting methods which were applied (for _naive_ forecast they are not computed),
* $p.val.: a list of \(p\)-values for \(t\)-test of statistical significance for coefficients from all forecasting methods which were applied (for _naive_ and _TVP_ models they are not computed, and for _Auto ARIMA_ z-test is used).  
These outcomes can be easily visualised with print.altf, summary.altf and plot.altf functions. The first function prints the computed forecast quality measures. The second, additionally provides mean values of coefficients and how often \(p\)-values for \(t\)-test of statistical significance for each explanatory variable in the model are below 1%, 5% and 10%, respectively. The third allows to graphically present:  
* regression coefficients in separate png files, saved in the current working directory, and moreover, to paste them into one big plot (also saved as png file in the current working directory),
* \(p\)-values for \(t\)-test of statistical significance for regression coefficients from applied models, in separate png files, saved in the current working directory, and moreover, to paste them into one big plot (also saved as png file in the current working directory).  
Coefficients are plotted only for _rec. OLS, roll. OLS, TVP, TVP-AR(1)_ and _TVP-AR(2)_ models. \(p\)-values are plotted only for _rec. OLS_ and _roll. OLS_.  
The next function allowing to quickly estimate some alternative forecast is altf3. This function estimates a rolling regression averaged over different window sizes. Indeed, sometimes there is uncertainty about the window size for the rolling regression, and averaging different models can be a reasonable approach [179].  
altf3(y, x = NULL, windows, av = NULL, initial.period = NULL, d = NULL, fmod = NULL, parallel = NULL, c = NULL)  
The arguments for this function are the following:  
* y should be a numeric or a column matrix representing the dependent variable,
* x is optional. This matrix represents the explanatory variables. Different columns should correspond to different explanatory variables. However, if it is not specified, then only the constant term is included,
* windows should be a numeric vector representing the sizes of rolling regression windows (i.e., numbers of observations),* av is optional. It indicates the method for model averaging. In particular,
* av = \"ord\" corresponds to equal weights for each model,
* av = \"aic\" corresponds to information theoretic model averaging based on Akaike Information Criterion (AIC),
* av = \"aicc\" corresponds to information theoretic model averaging based on Akaike Information Criterion with a correction for finite sample sizes (AIC),
* av = \"bic\" corresponds to information theoretic model averaging based on Bayesian Information Criterion (BIC),
* av = \"mse\" corresponds to setting weights proportional to the inverse of the models Mean Squared Error (MSE),
* If av is numeric, then weights are computed proportionally to the av-th power of the window size. In particular let there be \(K\) models considered with windows \(win_{1},\ldots,win_{K}\). Then, the weight of \(k\)-th model is given by \[w_{k}=\frac{(win_{k})^{\text{av}}}{\sum_{i=1}^{K}(win_{i})^{\text{av}}}\quad.\] The exact formulas for other av methods are given by Equations (22)-(26). If not specified av = \"ord\" is taken,
* initial.period is optional. This numeric represents the number of observation since which forecast quality measures are computed. If not specified the whole sample is used, i.e., initial.period = 1 is taken,
* d is optional. This logical is a parameter used for HR (Hit Ratio) calculation. It should be d = FALSE for level dependent time-series and d = TRUE if the dependent time-series represents changes. If not specified d = FALSE is taken,
* fmod is optional. This class dma object indicates the model to be compared with the alternative forecast,
* parallel is optional. This logical indicates whether parallel computations should be used. By default parallel = FALSE is taken,
* c is optional. This logical indicates whether a constant term should be included in the models. If not specified c = TRUE is used, i.e., constant term is included in the estimated models. Of course it is not possible to set simultaneously x = NULL and c = FALSE, as such settings would be automatically turned inside the function into c = TRUE. Of course, for each av method, in the initial period equal weights for each model are taken, and then successively updated based on the chosen criterion. The outcomes are a class altf3 object, i.e., a list of:
* $summary: a matrix of forecast quality measures ordered by columns,
* $y.hat: a list of predicted values from the rolling regressions averaged over the selected window sizes,
* $y: the dependent (forecasted) time-series,
* $coeff.: a list of coefficients from the rolling regressions averaged over the selected window sizes,
* $weights: a list of weights of the models used in averaging,
* $p.val.: a list of \(p\)-values (averaged over the selected window sizes) for \(t\)-test of statistical significance for the coefficients from the rolling regressions,
* $exp.win.