factors: Factor modeling: Inference for the number of factors

factorsR Documentation

Factor modeling: Inference for the number of factors

Description

factors() deals with factor modeling for high-dimensional time series proposed in Lam and Yao (2012):

{\bf y}_t = {\bf Ax}_t + {\boldsymbol{ε}}_t,

where {\bf x}_t is an r \times 1 latent process with (unknown) r ≤q p, {\bf A} is a p \times r unknown constant matrix, and {\boldsymbol{ε}}_t \sim \mathrm{WN}({\boldsymbol{μ}}_{ε}, {\bf Σ}_{ε}) is a vector white noise process. The number of factors r and the factor loadings {\bf A} can be estimated in terms of an eigenanalysis for a nonnegative definite matrix, and is therefore applicable when the dimension of {\bf y}_t is on the order of a few thousands. This function aims to estimate the number of factors r and the factor loading matrix {\bf A}.

Usage

factors(Y, lag.k = 5, twostep = FALSE)

Arguments

Y

{\bf Y} = \{{\bf y}_1, … , {\bf y}_n \}', a data matrix with n rows and p columns, where n is the sample size and p is the dimension of {\bf y}_t.

lag.k

Time lag k_0 used to calculate the nonnegative definte matrix \widehat{\mathbf{M}}:

\widehat{\mathbf{M}}\ =\ ∑_{k=1}^{k_0}\widehat{\mathbf{Σ}}_y(k)\widehat{\mathbf{Σ}}_y(k)',

where \widehat{\bf Σ}_y(k) is the sample autocovariance of {\bf y}_t at lag k.

twostep

Logical. If FALSE (the default), then standard procedures [See Section 2.2 in Lam and Yao (2012)] for estimating r and {\bf A} will be implemented. If TRUE, then a two step estimation procedure [See Section 4 in Lam and Yao (2012)] will be implemented for estimating r and {\bf A}.

Value

An object of class "factors" is a list containing the following components:

factor_num

The estimated number of factors \hat{r}.

loading.mat

The estimated p \times r factor loading matrix \widehat{\bf A}.

References

Lam, C. & Yao, Q. (2012). Factor modelling for high-dimensional time series: Inference for the number of factors, The Annals of Statistics, Vol. 40, pp. 694–726.

Examples

## Generate x_t
p <- 400
n <- 400
r <- 3
X <- mat.or.vec(n, r)
A <- matrix(runif(p*r, -1, 1), ncol=r)
x1 <- arima.sim(model=list(ar=c(0.6)), n=n)
x2 <- arima.sim(model=list(ar=c(-0.5)), n=n)
x3 <- arima.sim(model=list(ar=c(0.3)), n=n)
eps <- matrix(rnorm(n*p), p, n)
X <- t(cbind(x1, x2, x3))
Y <- A %*% X + eps
Y <- t(Y)
fac <- factors(Y,lag.k=2)
r_hat <- fac$factor_num
loading_Mat <- fac$loading.mat

HDTSA documentation built on Jan. 7, 2023, 5:26 p.m.

Related to factors in HDTSA...