# tuneFactors: Tune for the number of factors to use In sparseDFM: Estimate Dynamic Factor Models with Sparse Loadings

 tuneFactors R Documentation

## Tune for the number of factors to use

### Description

Uses Bai and Ng (2002) information criteria approach. Missing data is interpolated using the fillNA function.

### Usage

tuneFactors(
X,
type = 2,
standardize = TRUE,
r.max = min(15, ncol(X) - 1),
plot = TRUE
)


### Arguments

 X n x p numeric data matrix or data frame of (stationary) time series. type Character. Option for which information criteria to use. Default is 2. standardize Logical. Standardize the data before estimating the model. Default is TRUE. r.max Integer. Maximum number of factors to search for. Default is min(15,ncol(X)-1). plot Logical. Make a plot showing the IC value for each of the number of factors considered. Default is TRUE.

### Details

To calculate the number of factors to use in the model, the information criteria approach of Bai and Ng (2002) is used. This can be done before sparseDFM is fitted to the data to determine r. Bai and Ng (2002) consider 3 types of information criteria with different penalties of the form:

IC_1(r) = log\left(V_r(\hat{\bm{F}},\hat{\bm{\Lambda}})\right) + r \left( \frac{n+p}{np}\right)log\left( \frac{np}{n+p}\right)

IC_2(r) = log\left(V_r(\hat{\bm{F}},\hat{\bm{\Lambda}})\right) + r \left( \frac{n+p}{np} \right)log\left( min\{n,p\}\right)

IC_3(r) = log\left(V_r(\hat{\bm{F}},\hat{\bm{\Lambda}})\right) + r \frac{log\left( min\{n,p\}\right)}{min\{n,p\}}

The sum of squared residuals for r factors V_r(\hat{\bm{F}},\hat{\bm{\Lambda}}) = \sum_{i=1}^p\sum_{t=1}^n E[\hat{\epsilon}_{i,t}^2]/np with \hat{\epsilon}_{i,t} = X_{t,i}-\hat{\bm{F}}_t\hat{\bm{\Lambda}}_i is found using PCA on the standardized data set \bm{X}. The estimated factors \hat{\bm{F}} corresponding to the principle components and the estimated loadings \hat{\bm{\Lambda}} corresponding to the eigenvectors. Should the data contain missing values, then the missing data is interpolated using fillNA.

The number of factors to use will correspond to argmin_r IC_i(r) for i=1,2 or 3. Type 2 is the highest when working in finite samples and therefore is set to default.

### Value

The number of factors to use according to Bai and Ng (2002) information criteria.

### References

Bai, J., & Ng, S. (2002). Determining the number of factors in approximate factor models. Econometrica, 70(1), 191-221.

sparseDFM documentation built on March 31, 2023, 10:15 p.m.