# Dynamic Model Averaging in Economics and Finance with fDMA: A Package for R
## 1 Introduction  
This paper is organised as follows. The first section contains the general motivation and information about the package. The next section provides an economic motivation. It is focused on examples from oil market. However, it briefly provides arguments in favour of using model averaging and Bayesian methods in economics. This section contains also short information about the already done researches in which Dynamic Model Averaging (DMA) was used. The third section contains the brief note about the theory of DMA, Dynamic Model Selection (DMS) and Median Probability Model. In the fourth section the main function of this package is described. The fifth section provides some information about the implemented information-theoretic averaging. The sixth section describes some additional functions implemented in fDMA. These functions are mostly some variations about model averaging. The seventh section describes the implementation of the Diebold-Mariano test in such a way that the user can quickly compare forecasts from different models obtained with fDMA. The eighth section describes various minor functions from the package which can be helpful in organizing and making the work faster for a researcher working with fDMA package. The ninth section provides an example of direct application of fDMA for data from oil market. The user greedy for quick familiarizing with the package can directly go to this section and later read the whole paper. He or she can also start from this section and later seek the necessary information in other sections. The final section summarizes the performance of fDMA and compares it with other similar packages. The very first motivation behind the package described in this paper is to provide an easy and efficient tool for practitioners and/or researchers dealing with DMA. It provides not only the basic implementation of the method originally described by [PERSON] et al. [1], but also various later modifications of this method, and also some methods more or less linked with DMA. In other words,this package should be able to provide the toolbox for a researcher, which would be large enough to allow for a real-world application of DMA, Dynamic Model Selection (DMS) and Median Probability Model of Barbieri and Berger [2]. Moreover, some subjectively chosen (by the author of the package) alternative methods can also be quickly and easily performed. This should allow the user not only to perform DMA computations, but also to quickly compare the obtained outcomes with some popular alternative methods, in order to be able to compare the obtained results with some other methods. The set of these alternative methods is of course highly subjective. However it is not the most important part of this package, but rather some extra feature which is hoped to make the whole package more useful also for less advanced users. Although there are already two other competing DMA packages available, i.e., dma and eDMA [3, 4], there is still a place for a third one. In particular, the dma is able only to produce the original version of DMA algorithm. It does not allow the user to compute other variations emerging from this algorithm as DMS (Dynamic Model Selection) or Median Probability Model. Moreover, it is explained further in the text, that even the original DMA can be slightly modified, and various researches already proposed some small, but interesting, modification to the original algorithm. The fDMA [5] not only allows to implement these additional features, but even for the unmodified DMA is faster than the dma. In particular, the speed increase in fDMA is gained due to three factors. First, matrix computations are speeded through the use of xts package [6]. Secondly, the crucial part of the code is written with the help of C++ in Rcpp and Rcpp:Armadillo. Thirdly, the user might order the parallel computations [7, 8, 9, 10, 11, 12]. Actually, in case of speed eDMA is superior over fDMA in the use of both C++ and parallel computations.