| twoStepDenseDFM | R Documentation |
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.
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
)
data |
Numeric (no_of_vars |
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 ( |
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. |
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.
An object of class SDFMFit with main components:
Original data object.
Numeric matrix of estimated factor loadings.
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.
(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.
Integer order of the VAR process in the state equation.
Numeric lower-triangular Cholesky factor of the estimated measurement error variance–covariance matrix.
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.
Domenic Franjic
koopman2000fastTwoStepSDFM
\insertRefGiannone2008NowcastingTwoStepSDFM
\insertRefeigenwebTwoStepSDFM
\insertRefDoz2011Two_stepTwoStepSDFM
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.
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`
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.