This R
package is developed for testing simultaneous diagonalizability.
To install, use the code in R
:
devtools::install_github('XycYuchenXu/eigTest', force = T, build_vignettes = T)
The package has the following functionalities:
-
Check whether the means of two random square matrices (
matrixA
andmatrixB
) with dimensiond
-by-d
are simultaneously diagonalizable, either considering the commutator of the two matrices (use functioncommutatorTest
), or using the log-likelihood ratio test framework (projTest
), given asymptotic limiting covariance matrices (covMatA
andcovMatB
) and a convergence rate (cn
). For both functions, one needs to input an array of two matrices (A
such thatA[1,,] = matrixA
andA[2,,] = matrixB
), an array of two limiting covariance matrices (cov.arr
such thatcov.arr[1,,] = covMatA
andcov.arr[2,,] = covMatB
), and the convergence rate (cn
). -
Given an array of square random matrices (
A
), estimate a common eigenvector matrixV
(by supplying the array of matricesA
for functionJDTE
). -
Test whether the array of means matrices (
A
with dimensionp
-by-d
-by-d
andp
≥ 2) for random matrices are simultaneously diagonalizable, by checking whether the eigenvector matrix estimated above (V
) is indeed the common eigenvector matrix. Use functioneigTest
with input of two arrays (A
andcov.arr
) and the convergence ratecn
. -
Given an array of square random matrices (
A
with dimensionp
-by-d
-by-d
), estimatek
(k
≤d
) common eigenvectorsVk
(by supplying the array of matricesA
and parameterk
for functionexpmPartSchur
). -
Test whether the array of the random estimates (
A
with dimensionp
-by-d
-by-d
andp
≥ 2) for mean matrices sharek
of the alld
eigenvectors (k
≤d
), by checking whether thek
estimated common eigenvectorsVk
from optimization above are indeed the common eigenvectors. Use functionpartialTest
with input of two arrays (A
andcov.arr
), the convergence ratecn
, and number of common eigenvectorsk
.Vk
is optional here aspartialTest
can call the optimization function. -
Generate Gaussian samples for simulations. The function
generateMeans
is used to generatep
mean matrices with dimensiond
-by-d
and noise levelssnr
of common eigenvectorsV
. FunctionsimuSamples
takes the output fromgenerateMeans
as input for mean matrices. For each mean matrix, it generatescn^2
Gaussian random matrices (with identity covariance matrix), and compute the sample mean and the sample covariance matrix as consistent estimators. It then combines those estimates into a list of sub-lists that include estimated meanmu.bar
and covariancecov.bar
. -
For more details, read the vignette:
browseVignettes('eigTest')
and the paper 'Testing Simultaneous Diagonalizability'.