
Minimizes 3 information criteria proposed by Bai and Ng (2002) to determine the optimal number of factors r* to be used in an approximate factor model. A Screeplot can also be computed to eyeball the number of factors in the spirit of Onatski (2010).
ICr(X, max.r = min(20, ncol(X) - 1))# S3 method for ICr
print(x, ...)
# S3 method for ICr
plot(x, ...)
# S3 method for ICr
screeplot(x, type = "pve", show.grid = TRUE, max.r = 30, ...)
A list of 4 elements:
T x n
matrix of principle component factor estimates.
the eigenvalues of the covariance matrix of X
.
r.max x 3
'table' containing the 3 information criteria of Bai and Ng (2002), computed for all values of r
from 1:r.max
.
vector of length 3 containing the number of factors (r
) minimizing each information criterion.
a T x n
numeric data matrix or frame of stationary time series.
integer. The maximum number of factors for which IC should be computed (or eigenvalues to be displayed in the screeplot).
an object of type 'ICr'.
character. Either "ev"
(eigenvalues), "pve"
(percent variance explained), or "cum.pve"
(cumulative PVE). Multiple plots can be requested.
logical. TRUE
shows gridlines in each plot.
Following Bai and Ng (2002) and De Valk et al. (2019), let
The optimal number of factors r* corresponds to the minimum IC. The three criteria are are asymptotically equivalent, but may give significantly
different results for finite samples. The penalty in
In the Screeplot a horizontal dashed line is shown signifying an eigenvalue of 1, or a share of variance corresponding to 1 divided by the number of eigenvalues.
Bai, J., Ng, S. (2002). Determining the Number of Factors in Approximate Factor Models. Econometrica, 70(1), 191-221. tools:::Rd_expr_doi("10.1111/1468-0262.00273")
Onatski, A. (2010). Determining the number of factors from empirical distribution of eigenvalues. The Review of Economics and Statistics, 92(4), 1004-1016.
De Valk, S., de Mattos, D., & Ferreira, P. (2019). Nowcasting: An R package for predicting economic variables using dynamic factor models. The R Journal, 11(1), 230-244.
library(xts)
library(vars)
ics = ICr(diff(BM14_M))
print(ics)
plot(ics)
screeplot(ics)
# Optimal lag-order with 6 factors chosen
VARselect(ics$F_pca[, 1:6])
Run the code above in your browser using DataLab