MyNixOS website logo
Description

Estimate a Sparse Mixed Frequency Gaussian Factor Model Using a Two-Step Procedure.

Estimate a sparse Gaussian state-space model with mixed frequency data via sparse principal components analysis and the Kalman filter and smoother. For more details see Franjic and Schweikert (2024) <doi:10.2139/ssrn.4733872>.

TwoStepSDFM

A C++-based R implementation of the two-step estimation procedure for a (linear Gaussian) Sparse Dynamic Factor Model (SDFM) as outlined in Franjic and Schweikert (2024).

Introduction

The TwoStepSDFM package provides a fast implementation of the Kalman Filter and Smoother (hereinafter KFS, see Koopman and Durbin, 2000) to estimate factors in a mixed-frequency SDFM framework, explicitly accounting for cross-sectional correlation in the measurement error. The KFS is initialized using results from Sparse Principal Components Analysis (SPCA) by Zou and Hastie (2006) in a preliminary step. This approach generalizes the two-step estimator for approximate dynamic factor models by Giannone, Reichlin, and Small (2008) and Doz, Giannone, and Reichlin (2011). For more details see Franjic and Schweikert (2024).

Main Features

  • Fast Model Simulation: The simFM() function provides a flexible framework to simulate mixed-frequency data with ragged edges from an approximate DFM.
  • Estimation of the Number of Factors: The noOfFactors() function uses the Onatski (2009) procedure to estimate the number of factors efficiently while providing good finite sample performance.
  • Fast Model Estimation: The twoStepSDFM() function provides a fast, memory-efficient, and convenient implementation of the two-step estimator outlined in Franjic and Schweikert (2024).
  • Fast Hyper-Parameter Cross-Validation: The crossVal() function provides a fast and parallel cross-validation wrapper to retrieve the optimal hyper-parameters using time-series cross-validation (Hyndman and Athanasopoulos 2018) with random hyper-parameter search (Bergstra and Bengio 2012).
  • Fast Model Prediction: The nowcast() function is a highly convenient prediction function for backcasts, nowcasts, and forecasts of multiple targets. It automatically takes care of all issues arising with mixed-frequency data and ragged edges.
  • Compatibility: All functions take advantage of C++ for enhanced speed and memory-efficiency.

Side Features

  • Fast dense DFM estimation and prediction: The nowcast() function is also able to produce predictions of a dense DFM according to Giannone, Reichlin, and Small (2008). The function twoStepDenseDFM() additionally exposes an estimation procedure for the dense two-step estimator.
  • Fast SPCA: sparsePCA() exposes the internal C++-backed SPCA routine in R. This provides access to a fast and memory-efficient SPCA estimation routine as implemented by Zou and Hastie (2020) in pure R.
  • Fast Kalman Filter and Smoother: The kalmanFilterSmoother() function exposes the internal C++-backed KFS routine.

Installation

The package is available on CRAN and can be installed via install.packages("TwoStepSDFM"). If this turns out to be no longer possible, run the PackageBuilder.R file.

Prerequisites

For the installation from source via the PackageBuilder.R file, the following is required:

  • Rcpp: A package for integrating C++ code into R (Eddelbuettel and François, 2011). Rcpp CRAN repository
  • RcppEigen: A package for integrating the Eigen linear algebra library into R (Bates and Eddelbuettel, 2013). RcppEigen CRAN repository
  • GCC compiler (version 5.0 or later) GCC Website.

Usage

For a quick step-by-step user guide of the main features, see the package vignette.

License

License: GPL v3

(C) 2024-2026 Domenic Franjic

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

To Contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes with descriptive messages.
  4. Push to your fork and submit a pull request.

Support

If you have any questions or need assistance, please open an issue on the GitHub repository or contact us via email.

Contact

  • Name: Domenic Franjic
  • Institution: University of Hohenheim
  • Department: Econometrics and Statistics, Core Facility Hohenheim
  • E-Mail: [email protected]

References

Papers

Books

  • Hyndman, Rob J., and George Athanasopoulos (2018). Forecasting: Principles and Practice (3rd ed.). OTexts Melbourne.

Software / Packages

Metadata

Version

0.2.2

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows