Title: | Iterative Alternating Least Square Estimation for Large-Dimensional Matrix Factor Model |
---|---|
Description: | The matrix factor model has drawn growing attention for its advantage in achieving two-directional dimension reduction simultaneously for matrix-structured observations. In contrast to the Principal Component Analysis (PCA)-based methods, we propose a simple Iterative Alternating Least Squares (IALS) algorithm for matrix factor model, see the details in He et al. (2023) <arXiv:2301.00360>. |
Authors: | Yong He [aut], Ran Zhao [aut, cre], Wen-Xin Zhou [aut] |
Maintainer: | Ran Zhao <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 0.1.3 |
Built: | 2024-10-14 06:19:03 UTC |
Source: | CRAN |
Calculate the distance between spaces spanned by the column of two matrices. The distance is between 0 and 1. If the two spaces are the same, the distance is 0. if the two spaces are orthogonal, the distance is 1.
Distance(Z1, Z2)
Distance(Z1, Z2)
Z1 |
Input a matrix with |
Z2 |
Input another matrix with |
Define
By the definition of , we can easily see that
, which measures the distance between the column spaces spanned by two orthogonal matrices
and
, i.e.,
and
. In particular,
and
are the same when
, while
and
are orthogonal when
. The Gram-Schmidt orthogonalization can be used to make
and
column-orthogonal matrices.
Output a number between 0 and 1.
Yong He, Ran Zhao, Wen-Xin Zhou.
He, Y., Zhao, R., & Zhou, W. X. (2023). Iterative Least Squares Algorithm for Large-dimensional Matrix Factor Model by Random Projection. <arXiv:2301.00360>.
set.seed(1111) A=matrix(rnorm(10),5,2) B=matrix(rnorm(15),5,3) Distance(A,B)
set.seed(1111) A=matrix(rnorm(10),5,2) B=matrix(rnorm(15),5,3) Distance(A,B)
This function is designed to fit the matrix factor model using the Iterative Least Squares (IALS) method, rather than Principal Component Analysis (PCA)-based methods. In detail, in the first step, we propose to estimate the latent factor matrices by projecting the matrix observations with two deterministic weight matrices, chosen to diversify away the idiosyncratic components. In the second step, we update the row/column loading matrices by minimizing the squared loss function under the identifiability condition. The estimators of the loading matrices are then treated as the new weight matrices, and the algorithm iteratively performs these two steps until a convergence criterion is reached.
IALS(X, W1 = NULL, W2 = NULL, m1, m2, max_iter = 100, ep = 1e-06)
IALS(X, W1 = NULL, W2 = NULL, m1, m2, max_iter = 100, ep = 1e-06)
X |
Input an array with |
W1 |
The initial value for the row factor loading matrix. The default is NULL, with an initial estimate chosen from |
W2 |
The initial value for the column factor loading matrix. The default is NULL, with an initial estimate chosen from |
m1 |
A positive integer indicating the row factor number. |
m2 |
A positive integer indicating the column factor number. |
max_iter |
The maximum number of iterations for the algorithm, default is 100. |
ep |
The stopping criterion in the iteration algorithm, default is |
Assume we have two weight matrices of dimension
for
, as substitutes for
and
respectively. Then it is straightforward to estimate
simply by
Given and
, we can derive that
Similarly, we get the following estimator of the column factor loading matrix
Afterwards, we sequentially update ,
and
. In simulation, the iterative procedure is terminated either when a pre-specified maximum iteration number (
) is reached or when
where is the common component estimated at the
-th step,
is a small constant (
) given in advance.
The return value is a list. In this list, it contains the following:
R |
The estimated row loading matrix of dimension |
C |
The estimated column loading matrix of dimension |
F |
The estimated factor matrix of dimension |
iter |
The number of iterations when the stopping criterion is met. |
Yong He, Ran Zhao, Wen-Xin Zhou.
He, Y., Zhao, R., & Zhou, W. X. (2023). Iterative Alternating Least Square Estimation for Large-dimensional Matrix Factor Model. <arXiv:2301.00360>.
set.seed(11111) T=20;p1=20;p2=20 k1=3;k2=3 R=matrix(runif(p1*k1,min=-1,max=1),p1,k1) C=matrix(runif(p2*k2,min=-1,max=1),p2,k2) X=E=array(0,c(T,p1,p2)) F=array(0,c(T,k1,k2)) for(t in 1:T){ F[t,,]=matrix(rnorm(k1*k2),k1,k2) E[t,,]=matrix(rnorm(p1*p2),p1,p2) } for(t in 1:T){ X[t,,]=R%*%F[t,,]%*%t(C)+E[t,,] } #Estimating the matrix factor model using the default initial values fit1 = IALS(X, W1 = NULL, W2 = NULL,k1, k2, max_iter = 100, ep = 1e-06) Distance(fit1$R,R);Distance(fit1$C,C) #Estimating the matrix factor model using one-step iteration fit2 = IALS(X, W1 = NULL , W2 = NULL, k1, k2, max_iter = 1, ep = 1e-06) Distance(fit2$R,R);Distance(fit2$C,C)
set.seed(11111) T=20;p1=20;p2=20 k1=3;k2=3 R=matrix(runif(p1*k1,min=-1,max=1),p1,k1) C=matrix(runif(p2*k2,min=-1,max=1),p2,k2) X=E=array(0,c(T,p1,p2)) F=array(0,c(T,k1,k2)) for(t in 1:T){ F[t,,]=matrix(rnorm(k1*k2),k1,k2) E[t,,]=matrix(rnorm(p1*p2),p1,p2) } for(t in 1:T){ X[t,,]=R%*%F[t,,]%*%t(C)+E[t,,] } #Estimating the matrix factor model using the default initial values fit1 = IALS(X, W1 = NULL, W2 = NULL,k1, k2, max_iter = 100, ep = 1e-06) Distance(fit1$R,R);Distance(fit1$C,C) #Estimating the matrix factor model using one-step iteration fit2 = IALS(X, W1 = NULL , W2 = NULL, k1, k2, max_iter = 1, ep = 1e-06) Distance(fit2$R,R);Distance(fit2$C,C)
The function is to estimate the pair of factor numbers via eigenvalue ratios corresponding to IALS method.
KIALS(X, W1 = NULL, W2 = NULL, kmax, max_iter = 100, ep = 1e-06)
KIALS(X, W1 = NULL, W2 = NULL, kmax, max_iter = 100, ep = 1e-06)
X |
Input an array with |
W1 |
The initial value for the row factor loading matrix. The default is NULL, with an initial estimate chosen from |
W2 |
The initial value for the column factor loading matrix. The default is NULL, with an initial estimate chosen from |
kmax |
The user-supplied maximum factor numbers. Here it means the upper bound of the number of row factors and column factors. |
max_iter |
The maximum number of iterations for the algorithm, default is 100. See in |
ep |
The stopping criterion in the iteration algorithm, default is |
In detail, we first set is a predetermined upper bound for
and thus by
IALS
method, we can obtain the estimate of , denote as
, which is of dimension
. Then the dimensions
and
are further determined as follows:
\eqn{k_1} |
The estimated row factor number. |
\eqn{k_2} |
The estimated column factor number. |
Yong He, Ran Zhao, Wen-Xin Zhou.
He, Y., Zhao, R., & Zhou, W. X. (2023). Iterative Alternating Least Square Estimation for Large-dimensional Matrix Factor Model. <arXiv:2301.00360>.
set.seed(11111) T=20;p1=20;p2=20 k1=3;k2=3 R=matrix(runif(p1*k1,min=-1,max=1),p1,k1) C=matrix(runif(p2*k2,min=-1,max=1),p2,k2) X=E=array(0,c(T,p1,p2)) F=array(0,c(T,k1,k2)) for(t in 1:T){ F[t,,]=matrix(rnorm(k1*k2),k1,k2) E[t,,]=matrix(rnorm(p1*p2),p1,p2) } for(t in 1:T){ X[t,,]=R%*%F[t,,]%*%t(C)+E[t,,] } kmax=8 K=KIALS(X, W1 = NULL, W2 = NULL, kmax, max_iter = 100, ep = 1e-06);K
set.seed(11111) T=20;p1=20;p2=20 k1=3;k2=3 R=matrix(runif(p1*k1,min=-1,max=1),p1,k1) C=matrix(runif(p2*k2,min=-1,max=1),p2,k2) X=E=array(0,c(T,p1,p2)) F=array(0,c(T,k1,k2)) for(t in 1:T){ F[t,,]=matrix(rnorm(k1*k2),k1,k2) E[t,,]=matrix(rnorm(p1*p2),p1,p2) } for(t in 1:T){ X[t,,]=R%*%F[t,,]%*%t(C)+E[t,,] } kmax=8 K=KIALS(X, W1 = NULL, W2 = NULL, kmax, max_iter = 100, ep = 1e-06);K