twoStepDenseDFM: Two Step Dense Dynamic Factor Model Estimator.

twoStepDenseDFMR Documentation

Two Step Dense Dynamic Factor Model Estimator.

Description

Estimate a dense dynamic factor model with measurement equation

\bm{x}_t = \bm{\Lambda} \bm{f}_{t} + \bm{\xi}_t,\quad \bm{\xi}_t \sim \mathcal{N}(\bm{0}, \bm{\Sigma}_{\xi}),

and transition equation

\bm{f}_t = \sum_{p=0}^P\bm{\Phi}_p \bm{f}_{t-p} + \bm{\epsilon}_t,\quad \bm{\epsilon}_t \sim \mathcal{N}(\bm{0}, \bm{\Sigma}_{f}).

using principal components analysis and the Kalman Filter and Smoother according to \insertRefGiannone2008NowcastingTwoStepSDFM and \insertRefDoz2011Two_stepTwoStepSDFM.

Usage

twoStepDenseDFM(
  data,
  delay,
  no_of_factors,
  max_factor_lag_order = 10,
  lag_estim_criterion = "BIC",
  decorr_errors = TRUE,
  comp_null = 1e-15,
  parallel = FALSE,
  fcast_horizon = 0,
  jitter = 1e-08
)

Arguments

data

Numeric (no_of_vars \times no_of_obs) matrix of data or zoo/xts object sampled at the same frequency.

delay

Integer vector of variable delays.

no_of_factors

Integer number of factors.

max_factor_lag_order

Integer maximum order of the VAR process in the transition equation.

lag_estim_criterion

Information criterion used for the estimation of the factor VAR order ("BIC" (default), "AIC", "HIC").

decorr_errors

Logical, whether or not the errors should be decorrelated.

comp_null

Numeric computational zero.

parallel

Logical, whether or not to use Eigen's internal parallel matrix operations.

fcast_horizon

Integer number of additional Filter predictions into the future.

jitter

Numerical jitter for stability of internal solver algorithms. The jitter is added to the diagonal entries of the variance covariance matrix of the measurement errors.

Details

The function performs a two-step estimation procedure for dense dynamic factor models as described in \insertRefGiannone2008NowcastingTwoStepSDFM and \insertRefDoz2011Two_stepTwoStepSDFM. In the first step, the factor loading matrix is estimated using PCA. In the second step the latent factors are estimated using the univariate representation of the Kalman Filter and Smoother \insertCitekoopman2000fastTwoStepSDFM.

With respect to the univariate representation of the Kalman filter and smoother, decorr_errors indicates whether the data should be decorrelated internally prior to filtering and smoothing. jitter is added to the diagonal elements of the measurement variance–covariance matrix. For more details, see kalmanFilterSmoother.

Value

An object of class SDFMFit with main components:

data

Original data object.

loading_matrix_estim

Numeric matrix of estimated factor loadings.

smoothed_factors

Object containing the SPCA factor estimates. The object inherits its class from data: If data is provided as zoo, factor_estim will be a zoo object. If data is provided as matrix, factor_estim will be a (no_of_factors\timesno_of_obs matrix.

smoothed_state_variance

(no_of_factors\times( no_of_factors * no_of_obs)) matrix, where each (no_of_factors \timesno_of_factors) block represents the smoother uncertainty at time pointt.

factor_var_lag_order

Integer order of the VAR process in the state equation.

error_var_cov_cholesky_factor

Numeric lower-triangular Cholesky factor of the estimated measurement error variance–covariance matrix.

llt_success_code

Integer indicating the status of the Cholesky factorization: 0 = LLT succeeded, -1 = LLT failed but LDLT succeeded, -2 = both failed and errors are treated as uncorrelated.

Author(s)

Domenic Franjic

References

\insertRef

koopman2000fastTwoStepSDFM

\insertRef

Giannone2008NowcastingTwoStepSDFM

\insertRef

eigenwebTwoStepSDFM

\insertRef

Doz2011Two_stepTwoStepSDFM

See Also

sparsePCA: Routine for fitting estimating a sparse factor loading matrix.

kalmanFilterSmoother: Routine for filtering and smoothing latent factors.

twoStepSDFM: Two-step estimation routine for a sparse dynamic factor model.

Examples

data(factor_model)
no_of_vars <- dim(factor_model$data)[2]
no_of_factors <- dim(factor_model$factors)[2]
dfm_fit <- twoStepDenseDFM(data = factor_model$data, delay = factor_model$delay, 
                           no_of_factors = no_of_factors)
print(dfm_fit)
dfm_plots <- plot(dfm_fit)
dfm_plots$`Factor Time Series Plots`
dfm_plots$`Loading Matrix Heatmap`
dfm_plots$`Meas. Error Var.-Cov. Matrix Heatmap`
dfm_plots$`Meas. Error Var.-Cov. Eigenvalue Plot`


TwoStepSDFM documentation built on May 19, 2026, 9:07 a.m.