Introducing dfms: Efficient Estimation of Dynamic Factor Models in R

[This article was first published on R, Econometrics, High Performance, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This short post notifies you of the CRAN release of a new R package, dfms, to efficiently estimate dynamic factor models in R using the Expectation Maximization (EM) algorithm and Kalman Filtering. Estimation can be done in 3 different ways following:

  • Doz, C., Giannone, D., & Reichlin, L. (2011). A two-step estimator for large approximate dynamic factor models based on Kalman filtering. Journal of Econometrics, 164(1), 188-205. doi:10.1016/j.jeconom.2011.02.012

  • Doz, C., Giannone, D., & Reichlin, L. (2012). A quasi-maximum likelihood approach for large, approximate dynamic factor models. Review of economics and statistics, 94(4), 1014-1024. doi:10.1162/REST_a_00225

  • Banbura, M., & Modugno, M. (2014). Maximum likelihood estimation of factor models on datasets with arbitrary pattern of missing data. Journal of Applied Econometrics, 29(1), 133-160. doi:10.1002/jae.2306

The models is

\[\textbf{x}_t = \textbf{C} \textbf{f}_t + \textbf{e}_t \ \sim\ N(\textbf{0}, \textbf{R})\] \[\textbf{f}_t = \sum_{i=1}^p \textbf{A}_p \textbf{f}_{t-p} + \textbf{u}_t \ \sim\ N(\textbf{0}, \textbf{Q})\]

where the first equation is called the measurement or observation equation, the second equation is called transition, state or process equation, and

  • \(\textbf{x}_t\) is a \(n \times 1\) vector of observed series at time \(t\)
  • \(\textbf{f}_t\) is a \(r \times 1\) vector of unobserved factors at time \(t\)
  • \(\textbf{C}\) is a \(n \times r\) measurement (observation) matrix
  • \(\textbf{A}_j\) is a \(r \times r\) state transition matrix at lag \(j\)
  • \(\textbf{Q}\) is a \(r \times r\) state covariance matrix
  • \(\textbf{R}\) is a \(n \times n\) measurement (observation) covariance matrix and assumed to be diagonal.

Estimation is done by finding initial values of the model matrices through PCA, and using those to run a Kalman Filter and Smoother to obtain an estimate of \(\textbf{f}_t\). In EM estimation the system matrices are then updated with the estimates from the Kalman Filter and Smoother, and the data is filtered and smoothed again until convergence of the Kalman Filter log-likelihood.

Estimation with dfms is very efficient, powered by RcppArmadillo and collapse, and supports arbitrary patterns of missing data following Banbura and Modugno (2014). A comprehensive set of methods allows for easy model interpretation and forecasting. The present release v0.1.3 does not support advanced DFM estimation features, such as accounting for serial correlation in \(\textbf{e}_t\) or \(\textbf{u}_t\), series of mixed frequency in \(\textbf{x}_t\), time-varying system matrices \(\textbf{C}_t\) and \(\textbf{A}_t\) or structural breaks in the estimation. Some of these features may be added in the future.

To learn more about dfms, check out the website, and in particular the introductory vignette, which provides a short walk-through of the package.

To leave a comment for the author, please follow the link and comment on their blog: R, Econometrics, High Performance.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)