# Dynamic Model Averaging in Economics and Finance with fDMA: A Package for R
## 6 Alternative Forecasts
: a list of the expected window size, i.e., weighted average of the window sizes. These outcomes can be easily visualised with print.altf3, summary.altf3 and plot.altf3 functions. The first function prints the computed forecast quality measures. The second, additionally provides
mean values of coefficients and how often \(p\)-values (averaged over the selected window sizes) 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:  
* the expected 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 (averaged over selected window sizes) for \(t\)-test of statistical significance for coefficients from the rolling regressions, 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),
* weights of all the models used in averaging,
* the expected window size, i.e., weighted average of the widow sizes. R> wti <- crudeoil[-1, 1] R> drivers <- (lag(crudeoil[, -1], k = 1))[-1, ]  
R> ld.wti <- (diff(log(wti)))[-1, ] R> ld.drivers <- (diff(log(drivers)))[-1, ]  
R> a <- altf3(y = ld.wti, x = ld.drivers, d = TRUE, av = \"aic\", + windows = c(36, 100, 150))  
R> summary(a) Mean coefficients: const MSCI TB3 MS CSP TWEXM PROD CONS VXO
0.0068 -0.0154 0.3069 -0.0541 -0.5156 0.0855 0.0142^0.0342 Frequency when p-values for t-test are less than: const MSCI TB3 MS CSP TWEXM PROD CONS VXO
0.01 0.00 0.00 0.03 0.02 0.00 0.00 0.00 0.00 0.05 0.01 0.07 0.25 0.10 0.01 0.00 0.07 0.00 0.10 0.07 0.16 0.33 0.17 0.08 0.11 0.14^0.11 Forecast quality measures: ME RMSE MAE MPE MAPE HR av. roll. OLS 0.0043 0.076 0.0614 105.2163 305.6757 0.5994 Finally, the function altf4 computes the selected forecast quality measures for the time-varying parameters rolling regressions averaged over different window sizes. Ascribing of weights for averaging is performed by the method of [PERSON] et al. [1], i.e., as in Equations (2) and (5). The difference between this method and DMA is that the state space of the models are constructed not by choosing different combinations of explanatory variables, but for a fixed set of explanatory variables various rolling windows sizes are chosen and the models constructed in such a way constitute the state space [79, 179]. In other words, function tvp is performed for full set of explanatory variables, but with different windows sizes. Models obtained in such a way are then recursively weighted with Equations (2) and (5). altf4(y, x, windows, V = NULL, alpha = NULL, lambda = NULL, initial.period = NULL, d = NULL, fmod = NULL, parallel = NULL, c = NULL, small.c = NULL)  
The arguments for this function are the following:y should be a numeric or a column matrix of the dependent variable,
* x should be a matrix of the explanatory variables, and different columns should correspond to different explanatory variables,
* windows should be a numeric vector. It indicates the sizes of the rolling regression windows (i.e., the numbers of observations),
* V is optional. This numeric represents the value of the parameter V in tvp function (taken for the rolling regression case). If not specified V = 1 is taken,
* lambda is optional. This numeric represents the forgetting factor used in tvp function. If not specified lambda = 0.99 is taken,
* alpha is optional. This numeric represents the forgetting factor \(\alpha\) in Equation (2). If not specified alpha = 0.99 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 used,
* 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 represent changes.