# Dynamic Model Averaging in Economics and Finance with fDMA: A Package for R
## 3 Theoretical Framework
### Dynamic Occam's Window  
Actually, DMA is quite computationally demanding technique. Generally, every new extra explanatory variable added to DMA increases the time of computations twice. Therefore, if dealingwith around 10 potential explanatory variables DMA still can be performed on an average computer machine. However, if the number of variables grows and is around 20 the time needed grows in exponential pattern. The use of simply faster machines, or more machines in parallel way is still not a satisfactory solution.  
[PERSON] and [PERSON] [172] proposed to apply dynamic Occam's window. In particular, their procedure, modifying DMA, can be described in the following steps. It should be noticed that the implementation slightly differs from the one described by [PERSON] and [PERSON] [172], but the idea remains unaffected.  
Suppose that one would like to estimate DMA for some set of models \(\mathcal{M}\) with observations covering the period up to time \(T\). And that this is computationally infeasible, i.e., \(\mathcal{M}\) is too large.  
The procedure is recursive, in the following sense.  
1. Assume that the standard DMA was performed for some subset of models \(\mathcal{M}_{t}\subset\mathcal{M}\), but for the observations up to time \(t\leq T\).
2. The DMA forecast is produced. It is called _DMA-E_. Basing on the weights given by Equation (5) the cut-off is performed, i.e., DMA forecast for the period \(t\) is made only from models with \[\pi_{t|t,i}\geq C\cdot\max_{k\in\mathcal{M}_{t}}\left\{\pi_{t|t,k}\right\}\quad.\] (19) Of course, the weights for the remaining models are normalized to sum up to 1. This forecast is called _DMA-R_.
3. The above cut-off reduces the set of models \(\mathcal{M}_{t}\). Such a reduced set is now expanded by new models constructed by adding or removing exactly one explanatory variable from all possible variables to each model in this reduced set of models. The constant term is not included in this adding/removing procedure. As a result, the set of models \(\mathcal{M}_{t+1}\) is created.
4. If \(t<T\) Step 1 is performed with the updated set of models. Otherwise, the procedure is stopped.  
In order to begin, the initial set of models should be specified, i.e., \(\mathcal{M}_{0}\). As \(\mathcal{M}_{0}=\mathcal{M}\) is usually too large even for the first step, there are two natural candidates. One can start with some random subset \(\mathcal{M}_{0}\subset\mathcal{M}\). The second option is to specify \(\mathcal{M}_{0}\) as the models consisting of exactly one explanatory variable. Moreover, the cut-off threshold \(C\) between 0 and 1 has to be specified. Moreover, the user should decide which forecast would be of his or her interest: DMA-R or DMA-E.  
Of course, the above scheme requires to estimate standard DMA \(T\) times, if the length of time-series is \(T\). But the idea behind the above concept is that in certain cases the suitable selection of threshold \(C\) can greatly reduce the number of models used in averaging. Therefore, leading to overall speed increase.  
Actually, the original version, described by [PERSON] and [PERSON] [172] was not making cut-off immediately as in the above presentation. It was allowed for the full initial set \(\mathcal{M}\) to be estimated with standard DMA for some short period. However, in majority of tests performed by the author of fDMA such calculations were still taking too much time. Therefore, the idea was kept, but small details are modified in fDMA. Indeed, [PERSON] and [PERSON] [172] also stated directly that, for example, the models expansion through adding/removing one explanatory variable might be replaced by some other procedure.