| Title: | Kronecker-Invariant Tests for High-Dimensional Separability Testing |
|---|---|
| Description: | Kronecker-invariant tests for high-dimensional separability testing of matrix-variate data, focusing on Gaussian populations as benchmark cases. Tests whether the population covariance matrix is represented as a Kronecker product of row and column covariance matrices. Implements the tests based on the eigenvalues of the sample core whose test statistics are invariant to the separable component of the population covariance matrix, referred to as Kronecker-invariance. Tests constructed using the largest eigenvalue and the separable expansion of the sample core and applying the extended likelihood ratio test for sphericity testing to the sample core. For details, see Sung and Hoff (2025) <doi:10.48550/arXiv.2506.17463>. |
| Authors: | Bongjung Sung [aut, cre] (ORCID: <https://orcid.org/0000-0002-2464-9977>) |
| Maintainer: | Bongjung Sung <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-07-15 20:46:15 UTC |
| Source: | https://github.com/cran/kro.inv.test |
Compute the sample covariance matrix of a given data tensor.
dat2cov(dat, center)dat2cov(dat, center)
dat |
the |
center |
logical, whether to center the data or not. |
the sample covariance matrix of a given data tensor dat.
Bongjung Sung
set.seed(100) X=array(rnorm(36),dim=c(3,3,4)) dat2cov(X,center=TRUE)set.seed(100) X=array(rnorm(36),dim=c(3,3,4)) dat2cov(X,center=TRUE)
Implement the Monte-Carlo simulations of the test statistic based on the the extended LRT, applied to the sample core , for Gaussian populations as benchmark cases under the alternative regime.
Here the sample core refers to the core component of the sample covariance matrix . The test statistic may be transformed following Theorem 1–2 of Wang and Xu (2021) if trans=TRUE. This transformation is based on the quantities depending only on .
For the details, see Section 3.2 and 5.1 of Sung and Hoff (2025).
The population covariance matrix should be specified in sigma. Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
elrt.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )elrt.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic; TRUE by default. |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated test statistics based on the extended LRT, applied to the sample core, under the alternative.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
Wang, Z. and Xu, X. (2021). High-dimensional sphericity test by extended likelihood ratio. Metrika 84:1169—-1212.
p1=12; p2=10; r=4; n=200 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.95) elrt.alt(n,p1,p2,Sigma,center=FALSE,samp.num=20)p1=12; p2=10; r=4; n=200 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.95) elrt.alt(n,p1,p2,Sigma,center=FALSE,samp.num=20)
Implement the Monte-Carlo simulations of the test statistic based on the the extended LRT, applied to the sample core , for Gaussian populations as benchmark cases under the null hypothesis of separability.
Here the sample core refers to the core component of the sample covariance matrix . The extended LRT by Wang and Xu (2021) aims to test the sphericity of the population covariance matrix.
The test statistic may be transformed following Theorem 1–2 of Wang and Xu (2021) if trans=TRUE. This transformation is based on the quantities depending only on .
For the details, see Section 3.2 and 5.1 of Sung and Hoff (2025). Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
elrt.null(n, p1, p2, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10)elrt.null(n, p1, p2, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10)
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic; TRUE by default. |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated null test statistics based on the extended LRT, applied to the sample core.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
Wang, Z. and Xu, X. (2021). High-dimensional sphericity test by extended likelihood ratio. Metrika 84:1169—-1212.
p1=10; p2=8; n=100 set.seed(100) elrt.null(n,p1,p2,center=FALSE,samp.num=20)p1=10; p2=8; n=100 set.seed(100) elrt.null(n,p1,p2,center=FALSE,samp.num=20)
Compute the parameters associated with transforming the extended LRT statistic based on the sample core.
elrt.para(p1, p2, n)elrt.para(p1, p2, n)
p1 |
the row dimension |
p2 |
the column dimension |
n |
the sample size |
a parameter that is associated with transforming the extended LRT statistic based on the sample core.
Bongjung Sung
p1=20; p2=10; n=200 elrt.para(p1,p2,n)p1=20; p2=10; n=200 elrt.para(p1,p2,n)
Evaluate the empirical power of the test based on the extended LRT to the sample core with i.i.d. random matrices generated according to with given (specified in sigma).
The power is evaluated with the transformed test statistic following Theorem 1–2 of Wang and Xu (2021).
Given a level (specified in alpha), the parametric power is evaluated. To this end, the p-value (para.pval) is first evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
Then the power (para.power) is evaluated as the proportion of these p-values smaller than . For details, see Section 5.2 of Sung and Hoff (2025).
If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
elrt.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )elrt.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
alpha |
the level of the test. |
center |
logical, whether to center the data or not; TRUE by default. |
null.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the null; 1000 by default. |
alt.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the alternative; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
elrt.power returns a list of the following elements:
the vector of alt.samp.num Monte-Carlo simulated test statistics under after some transformation;
the vector of null.samp.num Monte-Carlo simulated test statistics under the null after some transformation;
the vector of p-values for each test statistic in alt.stat evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
the proportion of the p-values in para.pval smaller than alpha;
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
Wang, Z. and Xu, X. (2021). High-dimensional sphericity test by extended likelihood ratio. Metrika 84:1169—-1212.
p1=12; p2=8; r=4; n=120 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) elrt.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)p1=12; p2=8; r=4; n=120 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) elrt.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)
Evaluate the empirical power of the test based on the extended LRT to the sample core with the tensor data, .
The power is evaluated with the transformed test statistic following Theorem 1–2 of Wang and Xu (2021).
Given a level (specified in alpha), the parametric power is evaluated. To this end, the p-value (para.pval) is first evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
Then the power (para.power) is evaluated as the proportion of these p-values smaller than . For details, see Section 5.2 of Sung and Hoff (2025).
If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
elrt.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)elrt.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)
dat |
the |
center |
logical, whether to center the data or not; TRUE by default. |
samp.num |
the number of iterations for simulating the transformed null test statistic; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
elrt.power.dat returns a list with the following elements:
the computed test statistic based on dat after some transformation;
the vector of samp.num Monte-Carlo simulated null test statistics after some transformation;
the p-value evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
Wang, Z. and Xu, X. (2021). High-dimensional sphericity test by extended likelihood ratio. Metrika 84:1169—-1212.
p1=14; p2=10; r=4; n=200 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) elrt.power.dat(dat,center=FALSE,samp.num=20)p1=14; p2=10; r=4; n=200 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) elrt.power.dat(dat,center=FALSE,samp.num=20)
Implement the Monte-Carlo simulations of the test statistic based on the largest eigenvalue of the sample core for Gaussian populations as benchmark cases under the alternative regime.
Here the sample core refers to the core component of the sample covariance matrix .
The test statistic may be transformed to approximate the Tracy-Widom (TW) law if trans=TRUE, particularly under the local alternative regime (see Theorem 2 of Sung and Hoff (2025)). This transformation is based on the quantities depending only on .
If the population covariance matrix of the mean is assumed to be known (sigma.known=TRUE), the transformation is done regardless of trans based on the Kronecker MLE (the separable component of ).
For the details, see (20) of Sung and Hoff (2025). Unless transformed, the function will return the values of .
Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
large.eig.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, sigma.known = FALSE, samp.num = 1000, iter = 10 )large.eig.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, sigma.known = FALSE, samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic to approximate |
sigma.known |
logical, whether to assume the known population covariance matrix or not; FALSE by default. If TRUE, the transformed test statistic is returned, regardless of |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated test statistics based on the largest eigenvalue of the sample core under the alternative.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=12; p2=8; n=120 set.seed(100) para.list=pi.rank2.core(p1,p2,lambda.gen=FALSE) lambda=1-(1/(96/2+1)) Sigma=pi.core(para.list,lambda0=lambda) large.eig.alt(n,p1,p2,sigma=Sigma,center=FALSE,samp.num=20)p1=12; p2=8; n=120 set.seed(100) para.list=pi.rank2.core(p1,p2,lambda.gen=FALSE) lambda=1-(1/(96/2+1)) Sigma=pi.core(para.list,lambda0=lambda) large.eig.alt(n,p1,p2,sigma=Sigma,center=FALSE,samp.num=20)
Implement the Monte-Carlo simulations of the test statistic based on the largest eigenvalue of the sample core for Gaussian populations as benchmark cases under the null hypothesis of separability.
Here the sample core refers to the core component of the sample covariance matrix .
The test statistic may be transformed to approximate the Tracy-Widom (TW) law if trans=TRUE. This transformation is based on the quantities depending only on .
If the population covariance matrix under the null is assumed to be known (sigma.known=TRUE), the transformation is done regardless of trans based on the Kronecker MLE (the separable component of ).
For the details, see (20) of Sung and Hoff (2025). Unless transformed, the function will return the values of .
Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
large.eig.null( n, p1, p2, center = TRUE, trans = TRUE, sigma.known = FALSE, samp.num = 1000, iter = 10 )large.eig.null( n, p1, p2, center = TRUE, trans = TRUE, sigma.known = FALSE, samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic to approximate |
sigma.known |
logical, whether to assume the known population covariance matrix or not; FALSE by default. If TRUE, the transformed test statistic is returned, regardless of |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated null test statistics based on the largest eigenvalue of the sample core.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=10; p2=10; n=400 set.seed(100) large.eig.null(n,p1,p2,center=FALSE,samp.num=20)p1=10; p2=10; n=400 set.seed(100) large.eig.null(n,p1,p2,center=FALSE,samp.num=20)
Evaluate the empirical power of the test based on with i.i.d. random matrices generated according to for the sample core with given (specified in sigma).
The power is evaluated with the transformed so that it may follow the Tracy-Widom law under the null and some local alternative regimes (see Theorem 2 of Sung and Hoff (2025)).
Given a level (specified in alpha), both parametric and nonparametric power are evaluated. For the parametric power, the p-value (para.pval) is first evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
Then the power (para.power) is evaluated as the proportion of these p-values smaller than . Similarly, to compute the nonparametric power, the p-value (nonpara.pval) is first evaluated for each test statistic by comparing it to the Tracy-Widom law.
Finally, the power (nonpara.power) is evaluated as an analogy to para.power. For details, see Section 5.2 of Sung and Hoff (2025).
If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
large.eig.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )large.eig.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
alpha |
the level of the test. |
center |
logical, whether to center the data or not; TRUE by default. |
null.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the null; 1000 by default. |
alt.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the alternative; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
large.eig.power returns a list of the following elements:
the vector of alt.samp.num Monte-Carlo simulated test statistics under after some transformation;
the vector of null.samp.num Monte-Carlo simulated test statistics under the null after some transformation;
the vector of p-values for each test statistic in alt.stat evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
the proportion of the p-values in para.pval smaller than alpha;
the vector of p-values for each test statistic in evaluated by comparing the test statistic to the Tracy-Widom law;
the proportion of the p-values in nonpara.pval smaller than alpha.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=10; p2=12; n=200 set.seed(100) para.list=pi.rank2.core(p1,p2,lambda.gen=FALSE) lambda=1-(0.84/(120/2+0.84)) Sigma=pi.core(para.list,lambda0=lambda) large.eig.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)p1=10; p2=12; n=200 set.seed(100) para.list=pi.rank2.core(p1,p2,lambda.gen=FALSE) lambda=1-(0.84/(120/2+0.84)) Sigma=pi.core(para.list,lambda0=lambda) large.eig.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)
Evaluate the empirical power of the test based on with the tensor data, .
The power is evaluated with the transformed so that it may follow the Tracy-Widom law under the null and some local alternative regimes (see Theorem 2 of Sung and Hoff (2025)).
The parametric p-value (para.pval) is evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
On the other hand, the nonparametric p-value (nonpara.pval) is evaluated for each test statistic by comparing it to the Tracy-Widom law.
For details, see Section 5.2 of Sung and Hoff (2025). If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
large.eig.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)large.eig.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)
dat |
the |
center |
logical, whether to center the data or not; TRUE by default. |
samp.num |
the number of iterations for simulating the transformed null test statistic; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
large.eig.power.dat returns a list with the following elements:
the computed test statistic based on dat after some transformation;
the vector of samp.num Monte-Carlo simulated null test statistics after some transformation;
the p-value evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
the p-value evaluated by comparing the test statistic to the Tracy-Widom law.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=10; p2=12; r=4; n=150 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) # local alternative Sigma=pi.core(para.list,lambda0=0.8) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) large.eig.power.dat(dat,center=FALSE,samp.num=20)p1=10; p2=12; r=4; n=150 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) # local alternative Sigma=pi.core(para.list,lambda0=0.8) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) large.eig.power.dat(dat,center=FALSE,samp.num=20)
Given a list of parameters constituting the covariance matrix with a partial-isotropy rank- core, the function assembles the covariance matrix using these parameters.
pi.core(para.list, lambda0 = 0.5, root = "sym")pi.core(para.list, lambda0 = 0.5, root = "sym")
para.list |
the list of parameters constituting the covariance matrix with a partial-isotropy rank- |
lambda0 |
the pre-specified value of the non-spiked eigenvalue |
root |
the choice of the square root of positive definite matrices; must be either |
a covariance matrix with a partial-isotropy rank- core.
The attribute of denotes the value of the non-spiked eigenvalue.
Bongjung Sung
set.seed(100) # generate a list of parameters for a covariance matrix of a partial-isotropy core. p1=14; p2=10; r=3 para.list=pi.rank_r.core(p1,p2,r) # assembles the covariance matrix using the above list of parameters. pi.core(para.list)set.seed(100) # generate a list of parameters for a covariance matrix of a partial-isotropy core. p1=14; p2=10; r=3 para.list=pi.rank_r.core(p1,p2,r) # assembles the covariance matrix using the above list of parameters. pi.core(para.list)
Randomly generate a list of parameters for the covariance matrix with a partial-isotropy rank- core for matrix-variate data.
pi.rank_r.core(p1, p2, r, lambda.gen = TRUE)pi.rank_r.core(p1, p2, r, lambda.gen = TRUE)
p1 |
the row dimension. |
p2 |
the column dimension. |
r |
the partial-isotropy rank. |
lambda.gen |
logical, whether to generate a non-spiked eigenvalue or not; TRUE by default. |
If a core covariance matrix is of rank- for general , the dimension should satisfy one of the followings: or , or .
The covariance matrix with a partial-isotropy rank- core takes the form of
for , positive definite matrices and of the dimensions and , respectively, and whose th column is a vectorization of matrix such that is a rank- core.
Here denotes either symmetric square root or the Cholesky factor of a positive definite matrix .
The separable and core components of , denoted and , are
For the exact formula when or , see Theorem 1 of Sung and Hoff (2025).
pi.rank_r.core returns a list with the following elements:
the row covariance matrix of dimension ;
the column covariance matrix of dimension ;
an array of factor matrices of a rank-r core of dimension ;
If lambda.gen=TRUE, the non-spiked eigenvalue . Otherwise, NULL.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
set.seed(100) # It must be that p1/p2+p2/p1<r or p1=p2r or p2=p1r p1=12; p2=8; r=3 pi.rank_r.core(p1,p2,r)set.seed(100) # It must be that p1/p2+p2/p1<r or p1=p2r or p2=p1r p1=12; p2=8; r=3 pi.rank_r.core(p1,p2,r)
Randomly generate a list of parameters for the covariance matrix with a partial-isotropy rank-1 core for square matrix-variate data.
pi.rank1.core(p1, lambda.gen = TRUE)pi.rank1.core(p1, lambda.gen = TRUE)
p1 |
the row and column dimensions. |
lambda.gen |
logical, whether to generate a non-spiked eigenvalue or not.; TRUE by default. |
If a core covariance matrix is of rank-1, the data should be a square matrix. Thus, the row and column dimensions must coincide.
The covariance matrix with a partial-isotropy rank-1 core takes the form of
for , positive definite matrices of the same dimensions , and such that is a rank-1 core.
Here denotes either symmetric square root or the Cholesky factor of a positive definite matrix .
The separable and core components of , denoted and , are
For the exact formula, see Theorem 1 of Sung and Hoff (2025).
pi.rank1.core returns a list with the following elements:
the row covariance matrix of dimension ;
the column covariance matrix of dimension ;
the factor matrix of a rank-1 core of dimension ;
If lambda.gen=TRUE, the non-spiked eigenvalue . Otherwise, NULL.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
set.seed(100) p1=10 pi.rank1.core(p1)set.seed(100) p1=10 pi.rank1.core(p1)
Randomly generate a list of parameters for the covariance matrix with a partial-isotropy rank-2 core for matrix-variate data.
pi.rank2.core(p1, p2, lambda.gen = TRUE)pi.rank2.core(p1, p2, lambda.gen = TRUE)
p1 |
the row dimension. |
p2 |
the column dimension. |
lambda.gen |
logical, whether to generate a non-spiked eigenvalue or not; TRUE by default. |
If a core covariance matrix is of rank-2, the dimension should satisfy one of the followings: or , or .
The covariance matrix with a partial-isotropy rank-2 core takes the form of
for , positive definite matrices and of the dimensions and , respectively, and whose th column is a vectorization of matrix such that is a rank-2 core.
Here denotes either symmetric square root or the Cholesky factor of a positive definite matrix .
The separable and core components of , denoted and , are
For the exact formula, see Theorem 1 of Sung and Hoff (2025).
pi.rank2.core returns a list with the following elements:
the row covariance matrix of dimension ;
the column covariance matrix of dimension ;
an array of factor matrices of a rank-2 core of dimension ;
If lambda.gen=TRUE, the non-spiked eigenvalue . Otherwise, NULL.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
set.seed(100) # It must be that p1=p2 or p1-p2|p1 (p1>p2) or p2-p1|p2 (p2>p1). p1=12; p2=10 pi.rank2.core(p1,p2)set.seed(100) # It must be that p1=p2 or p1-p2|p1 (p1>p2) or p2-p1|p2 (p2>p1). p1=12; p2=10 pi.rank2.core(p1,p2)
Implement the Monte-Carlo simulations of the test statistic based on the separable expansion of the sample core for Gaussian populations as benchmark cases under the alternative regime.
Here the sample core refers to the core component of the sample covariance matrix . The test statistic is given by
where for row and column dimensions, and , respectively.
The test statistic may be transformed as if trans=TRUE. For the details, see Section 3.3 and 5.1 of Sung and Hoff (2025).
The population covariance matrix should be specified in sigma. Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
sep.exp.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )sep.exp.alt( n, p1, p2, sigma, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic; TRUE by default. |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated test statistics based on the separable expansion of the sample core under the alternative.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=5; p2=3; r=4; n=100 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.95) sep.exp.alt(n,p1,p2,Sigma,center=FALSE,samp.num=20)p1=5; p2=3; r=4; n=100 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.95) sep.exp.alt(n,p1,p2,Sigma,center=FALSE,samp.num=20)
Implement the Monte-Carlo simulations of the test statistic based on the separable expansion of the sample core for Gaussian populations as benchmark cases under the null hypothesis of separability.
Here the sample core refers to the core component of the sample covariance matrix . The test statistic is given by
where for row and column dimensions, and , respectively.
The test statistic may be transformed as if trans=TRUE.
For the details, see Section 3.3 and 5.1 of Sung and Hoff (2025). Also, if the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, the data should be centered.
sep.exp.null( n, p1, p2, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )sep.exp.null( n, p1, p2, center = TRUE, trans = TRUE, samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
center |
logical, whether to center the data or not; TRUE by default. |
trans |
logical,whether to transform the test statistic; TRUE by default. |
samp.num |
the number of iterations for the Monte-Carlo simulation; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
the vector of samp.num Monte-Carlo simulated null test statistics based on the separable expansion of the sample core.
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=5; p2=3; n=60 set.seed(100) sep.exp.null(n,p1,p2,center=FALSE,samp.num=20)p1=5; p2=3; n=60 set.seed(100) sep.exp.null(n,p1,p2,center=FALSE,samp.num=20)
Evaluate the empirical power of the test based on the separable expansion of the sample core with i.i.d. random matrices generated according to with given (specified in sigma).
The test statistic is given by . The power is evaluated with respect to .
Given a level (specified in alpha), the parametric power is evaluated. To this end, the p-value (para.pval) is first evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
Then the power (para.power) is evaluated as the proportion of these p-values smaller than . For details, see Section 5.2 of Sung and Hoff (2025).
If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
sep.exp.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )sep.exp.power( n, p1, p2, sigma, alpha = 0.05, center = TRUE, null.samp.num = 1000, alt.samp.num = 1000, iter = 10 )
n |
the sample size. |
p1 |
the row dimension. |
p2 |
the column dimension. |
sigma |
the population covariance matrix. |
alpha |
the level of the test. |
center |
logical, whether to center the data or not; TRUE by default. |
null.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the null; 1000 by default. |
alt.samp.num |
the number of iterations for the Monte-Carlo simulation of the test statistics under the alternative; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
sep.exp.power returns a list of the following elements:
the vector of alt.samp.num Monte-Carlo simulated test statistics under after some transformation;
the vector of null.samp.num Monte-Carlo simulated test statistics under the null after some transformation;
the vector of p-values for each test statistic in alt.stat evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
the proportion of the p-values in para.pval smaller than alpha;
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=12; p2=10; r=4; n=100 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) sep.exp.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)p1=12; p2=10; r=4; n=100 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.98) sep.exp.power(n,p1,p2,Sigma,center=FALSE,null.samp.num=20,alt.samp.num=20)
Evaluate the empirical power of the test based on the separable expansion of the sample core with the tensor data, .
The test statistic is given by . The power is evaluated with respect to .
Given a level (specified in alpha), the parametric power is evaluated. To this end, the p-value (para.pval) is first evaluated for each test statistic by comparing it to the Monte-Carlo approximated null distribution (null.stat).
Then the power (para.power) is evaluated as the proportion of these p-values smaller than . For details, see Section 5.2 of Sung and Hoff (2025).
If the mean is assumed to be known, you may not center the data (center=FALSE). Otherwise, you should center the data (center=TRUE).
sep.exp.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)sep.exp.power.dat(dat, center = TRUE, samp.num = 1000, iter = 10)
dat |
the |
center |
logical, whether to center the data or not; TRUE by default. |
samp.num |
the number of iterations for simulating the transformed null test statistic; 1000 by default. |
iter |
the unit number at which to print the number of current iterations; 10 by default. |
sep.exp.power.dat returns a list with the following elements:
the computed test statistic based on dat after some transformation;
the vector of samp.num Monte-Carlo simulated null test statistics after some transformation;
the p-value evaluated based on Monte-Carlo approximated empirical null distribution (null.stat);
Bongjung Sung
Sung, B. and Hoff, P. (2025). Testing Separability of High-Dimensional Covariance Matrices. arXiv preprint arXiv:2506.17463.
p1=10; p2=12; r=4; n=100 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.99) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) sep.exp.power.dat(dat,center=FALSE,samp.num=20)p1=10; p2=12; r=4; n=100 p=p1*p2 set.seed(100) para.list=pi.rank_r.core(p1,p2,r,lambda.gen=FALSE) Sigma=pi.core(para.list,lambda0=0.99) Sigma.root=sym.root(Sigma) dat=crossprod(Sigma.root,matrix(rnorm(n*p),ncol=n)) dat=array(dat,dim=c(p1,p2,n)) dat=aperm(dat,perm=c(3,1,2)) sep.exp.power.dat(dat,center=FALSE,samp.num=20)
Compute the inverse of the symmetric square root of a positive definite matrix.
sym.inv.root(cov)sym.inv.root(cov)
cov |
a positive definite matrix. |
the inverse of the symmetric square root of given a positive definite matrix cov.
Bongjung Sung
# generate a positive definite matrix set.seed(100) X=matrix(rnorm(4*10),ncol=4) S=crossprod(X,X)/10 sym.inv.root(S)# generate a positive definite matrix set.seed(100) X=matrix(rnorm(4*10),ncol=4) S=crossprod(X,X)/10 sym.inv.root(S)
Compute the symmetric square root of a positive definite matrix.
sym.root(cov)sym.root(cov)
cov |
a positive definite matrix. |
the symmetric square root of given a positive definite matrix cov.
Bongjung Sung
# generate a positive definite matrix set.seed(100) X=matrix(rnorm(4*10),ncol=4) S=crossprod(X,X)/10 sym.root(S)# generate a positive definite matrix set.seed(100) X=matrix(rnorm(4*10),ncol=4) S=crossprod(X,X)/10 sym.root(S)
Compute parameters associated with transforming the largest eigenvalue of the sample core to obtain TW-law.
tw.para(K1, K2, n)tw.para(K1, K2, n)
K1 |
the |
K2 |
the |
n |
the sample size. |
a vector of parameters that are associated with transforming the largest eigenvalue of the sample core to obtain TW-law.
Bongjung Sung
set.seed(100) p1=3; p2=5; n=60; p=p1*p2 X=matrix(rnorm(p*n),ncol=p) S=crossprod(X,X)/n S.kcd=covKCD::covKCD(S,p1,p2) K1=S.kcd$K1 K2=S.kcd$K2 tw.para(K1,K2,n)set.seed(100) p1=3; p2=5; n=60; p=p1*p2 X=matrix(rnorm(p*n),ncol=p) S=crossprod(X,X)/n S.kcd=covKCD::covKCD(S,p1,p2) K1=S.kcd$K1 K2=S.kcd$K2 tw.para(K1,K2,n)