BaiNg: Bai and Ng's Criteria for Selecting Number of Probabilistic...

Description Usage Arguments Value References Examples

View source: R/Bai2002.R

Description

The function returns the choice for the number of factors in the context of probabilistic factor analysis.

Usage

1
BaiNg(lambda, M, bias = TRUE, option = 1, tau = 0.001, verbose = FALSE)

Arguments

lambda

a numeric vector of sample eigenvalues of length $n$.

M

the number of observations.

bias

a logical specifying whether the residual variance estimate used in the criterion should be biased or unbiased. See Bai and Ng (2002) for details.

option

an integer specifying the choice of the preferred asymptotics regime. See Bai and Ng (2002) for details.

tau

a tolerance threshold for the smallest eigenvalue, the default value is 0.001.

verbose

a logical specifying whether the posterior evidence or the integer that minimized the evidence should be returned

Value

an integer K between 1 and n

References

Bai, J., & Ng, S. (2002). Determining the number of factors in approximate factor models. **Econometrica**, *70*(1), 191-221. <doi:10.1111/1468-0262.00273>

Examples

1
2
3
4
5
6
7
## Not run: 
X <- MASS::mvrnorm(1000, mu = rep(0,10), Sigma = diag(1,10))
eigen_values <- eigen(as.matrix(Matrix::nearPD(stats::cov(scale(X)))$mat))$val
BaiNg(lambda = eigen_values, M=100)
BaiNg(lambda = eigen_values, M=5000)

## End(Not run)

WeiAkaneDeng/SPAC2 documentation built on Jan. 15, 2022, 5:01 a.m.