noOfFactors: Estimate the number of Factors

View source: R/EstimateFactors.R

noOfFactorsR Documentation

Estimate the number of Factors

Description

Estimate the number of factors of a linear Gaussian latent factor model using the eigenvalue slope test of \insertRefonatski2009testingTwoStepSDFM and the infromation criterion based approach of \insertRefbai2002determiningTwoStepSDFM.

Usage

noOfFactors(
  data,
  min_no_factors = 1,
  max_no_factors = 7,
  confidence_threshold = 0.05
)

Arguments

data

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

min_no_factors

Integer minimum number of factors to be tested.

max_no_factors

Integer maximum number of factors to be tested (should be at most min_no_factors + 17).

confidence_threshold

Numeric threshold value to stop the testing procedure.

Details

The \insertCiteonatski2009testingTwoStepSDFM procedure splits the data matrix along the time dimension into two equally sized (no_of_vars \times cut_off) sub-matrices \bm{X}_{1/2} and \bm{X}_{2/2}. It then proceeds to build \tilde{\bm{X}} := \bm{X}_{1/2} + i\bm{X}_{2/2}, where i=\sqrt{-1}. We then compute the eigenvalues of the Gram matrix \tilde{\bm{X}} \tilde{\bm{X}}^{\dagger}, where \tilde{\bm{X}}^{\dagger} represents the adjoint. Finally, a test based on the computed eigenvalues is performed. This test is an iterative testing procedure, starting by testing the null that the true number of factors is min_no_factors. If the test is rejected by comparison of the p-value against confidence_threshold, we test whether the true number of factors is min_no_factors + 1 until we can no longer reject at confidence_threshold or max_no_factors is reached.

As the distribution of the eigenvalues under the null is nonstandard \insertCiteonatski2009testingTwoStepSDFM, simulated critical values are used. They are retrieved from \insertRefonatski2009testing_suplTwoStepSDFM. As the range of the simulated critical values is limited, the minimum and maximum number of potential factors is limited such that max_no_factors should be no more than min_no_factors + 17. However, it is recommended to operate well below this maximum as the test size decreases with max_no_factors - min_no_factors.

The \insertCitebai2002determiningTwoStepSDFM information criterion determines the number of factors by minimising a BIC. Here, three different penalty terms are provided. It is up to the user to determine the most appropriate for the problem at hand. In general, however, the second information criterion is used.

Value

An object of class NoOfFactorsFit with components:

no_of_factors

Integer estimated number of factors.

p_value

Numeric p-value of the final test.

confidence_threshold

Numeric significance level used.

statistic

Numeric test statistic value of the last test.

eigen_values

Numeric vector of eigenvectors of the complex data Gram matrix.

Author(s)

Domenic Franjic

References

\insertRef

onatski2009testingTwoStepSDFM

\insertRef

onatski2009testing_suplTwoStepSDFM

Examples

data(factor_model)
no_of_factors_estim <- noOfFactors(data = factor_model$data, min_no_factors = 1, 
                                   max_no_factors = 5, confidence_threshold = 0.05)
print(no_of_factors_estim)
factor_estim_plots <- plot(no_of_factors_estim)
factor_estim_plots$`Eigen Value Plot Test Procedure`
factor_estim_plots$`IC plot for IC1`
factor_estim_plots$`IC plot for IC2`
factor_estim_plots$`IC plot for IC3`


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