Peter Hoff 2022-08-10
Let
be a sample of
matrices, and let
be their vectorizations. The sample covariance matrix
of
is a
positive semidefinite matrix, where
.
The Kronecker-core decomposition
of the covariance matrix
is a matrix factorization of the form
where
is a
matrix representing across-row covariance of the data matrices;
is a
matrix representing across-column covariance of the data matrices;
is a core covariance matrix with zero average across-row and across-column covariance.
The covariance matrix
represents the “separable part” of
,
whereas
represents the “nonseparable part”. In particular, if
is separable, than
.
Hoff, McCormack and Zhang (2022). Core Shrinkage Covariance Estimation for Matrix-variate Data.
# Development version
devtools::install_github("pdhoff/covKCD")
# CRAN-approved version
install.packages("covKCD")
p1<-3 ; p2<-4 ; n<-10
# Random sample of n independent standard normal p1xp2 matrices
Y<-array(rnorm(n*p1*p2),dim=c(n,p1,p2))
dim(Y)
## [1] 10 3 4
# Sample covariance matrix
S<-covKCD::mcov(Y)
dim(S)
## [1] 12 12
# KCD
KCDS<-covKCD::covKCD(S,p1,p2)
KCDS$K1
## [,1] [,2] [,3]
## [1,] 1.33635120 -0.44289281 -0.06881939
## [2,] -0.44289281 0.67144330 -0.02587571
## [3,] -0.06881939 -0.02587571 1.04758540
KCDS$K2
## [,1] [,2] [,3] [,4]
## [1,] 0.94256591 0.1405612 -0.23992050 0.01091884
## [2,] 0.14056122 0.9621321 -0.25617191 -0.01655000
## [3,] -0.23992050 -0.2561719 1.15019722 0.08804809
## [4,] 0.01091884 -0.0165500 0.08804809 0.70790240
# Check decomposition
K1h<-covKCD::msqrt(KCDS$K1)
K2h<-covKCD::msqrt(KCDS$K2)
range( kronecker(K2h,K1h) %*% KCDS$C %*% kronecker(K2h,K1h) - S )
## [1] -1.887379e-15 1.370432e-15