This package implements the algorithm proposed by Perrot-Dockès, Lévy-Leduc, and Rajjou (2018). For further details we refer the reader to this paper. We shall consider the following framework. Let E1, E2, ⋯, En, n zero-mean i.i.d. q-dimensional random vectors having a covariance matrix Σ such that the number q of its rows and columns is much larger than n. The goal of the package is to propose a new estimator of Σ and of the square root of its inverse in the particular case where Σ is assumed to have a block structure without limiting ourselves to diagonal blocks. More precisely, in this paper, we shall assume that
Σ = Z Z′ + D,
where Z is a q × k sparse matrix with k ≪ q, Z′ denotes the transpose of the matrix Z and D is a diagonal matrix such that the diagonal terms of Σ are equal to one.
Our approach consists in providing a low rank matrix approximation of the Z Z′ part of Σ and then in using a ℓ1 regularization in order to obtain a sparse estimator of Σ. More precisely, since Σ is a correlation matrix, it is a symmetric matrix with ones on its diagonal, thus all the information is contained in its upper triangular part without its diagonal. If we know P the (q − 1) × (q − 1) symmetric matrix, which has for upper triangular part the upper triangular part of Σ without its diagonal, we know Σ. The matrix P has the advantage to have a low rank. In the following, we propose to first estimate the block matrix P.
We shall moreover propose a methodology to estimate Σ in the case where the block structure is latent that is when the columns and rows of Σ have to be permuted according to an unknown permutation in order to make the block structure appear. In this case, a hierarchical clustering step has to be applied beforehand.
In order to generate a matrix Σ having a block structure
with extra-diagonal blocks and q = 100, we can use the function
|Simu_Sigma|
as follows:
The matrix Σ is displayed in Figure .
Using the matrix Σ
generated by the function |Simu_Sigma|
a n × q matrix E was generated such that
its rows are independent zero-mean Gaussian random vectors having a
covariance matrix equal to Σ and n = 30.
In order to get an estimator of Σ the function
|Sigma_estimation|
was applied. Since the data set was
simulated, the rank of P, the sub-matrix of Σ, and its number of non
null values are known.
k <- 5
nb_nn0 <- sum(Sigma[upper.tri(Sigma, diag = FALSE)] != 0)
res_known <- Sigma_estimation(E, k = k, nb_nn0 = nb_nn0)
Our estimator $$\widehat{\boldsymbol{\Sigma}}$$ of Σ is given by
|res_known$Sigma_est|
. It is displayed in Figure and is
obtained by using:
The Frobenius norm $\|\boldsymbol{\Sigma}-\widehat{\boldsymbol{\Sigma}}\|$ is equal to 5.5.
For comparison purpose, the sample correlation matrix is displayed in Figure .
The Frobenius norm $\|\boldsymbol{\Sigma}-\widehat{\boldsymbol{\Sigma}}_{\textrm{emp}}\|$ is equal to 14.5, where $\widehat{\boldsymbol{\Sigma}}_{\textrm{emp}}$ denotes the sample correlation matrix.
In practice, the number of non null values and the rank of P are unknown. These
parameters can be both estimated using the function
|Sigma_estimation|
.
For choosing the rank of P, two strategies are available in the package and compared in Perrot-Dockès, Lévy-Leduc, and Rajjou (2018):
To choose the number of non null values two methodologies are also available in the package and compared in Perrot-Dockès, Lévy-Leduc, and Rajjou (2018):
For example, an estimator of Σ using the criterion and
the method can be obtained by using the |Sigma_estimation|
function as follows:
It has to be noticed that “Cattell” and “Elbow” are the default value
for |method_k|
and |method_0|
respectively.
Hence, the same result can be obtain by using :
The corresponding estimator of Σ is displayed in Figure .
The estimated rank and the estimated number of non null values can be
obtained by |res$k|
and |res$nb_nn0|
,
respectively. Here, the estimated rank is equal to 5 and the estimated
number of non null values is 1155. Note that the true values of these
parameters are 5 and 1270.
An estimator of Σ using the criterion and the method can be obtained by using the function as follows:
The corresponding estimator of Σ is displayed in Figure . Here, the estimated rank is equal to 5 and the estimated number of non null values is 1121.
This second approach is a little bit slower than the first one especially for large values of q but can be more accurate when the number of samples is large enough, see Perrot-Dockès, Lévy-Leduc, and Rajjou (2018) for further details on the numerical and statistical performance of the different strategies.
We can see from this figure that the estimation of Σ does not seem to be altered by having to estimate the number of non null values and the rank of the matrix. The Frobenius norm $\|\boldsymbol{\Sigma}-\widehat{\boldsymbol{\Sigma}}\|$ is equal to 7.1 for the first estimator and to 8 for the second one.
An estimator of Σ−1/2 can be obtained using the function by setting the arguments to true as follows:
An estimator of Σ is obtained with and an estimator of Σ−1/2 is obtained with . It can be used to remove the dependence that may exist between the columns of E.
In practice, it is possible that the block structure of Σ only appears after having permuted its rows and columns according to a well chosen permutation. We explain hereafter how to estimate Σ and Σ−1/2 in this case. We first generate such a matrix by applying a random permutation to the rows and columns of the matrix Σ previously generated.
The corresponding matrix is displayed in Figure .
In such a situation where the columns and rows have to be permuted according to an unknown permutation, we propose to use a hierarchical clustering as the first step of our methodology and then use the same strategy. This is performed by putting in the arguments of the function .
E <- matrix(rnorm(n * q), ncol = q) %*% chol(as.matrix(Sigma_samp))
res_samp <- Sigma_estimation(E, reorder = TRUE, inv_12 = TRUE)
The estimated matrix is displayed in Figure .
The permutation to make the block structure appear is available from . The corresponding estimated correlation matrix in which the columns have been permuted in order to make the block structure appear is obtained using the following lines and is displayed in Figure :
This matrix has to be compared with the following one displayed in Figure :
Once again, our strategy does not seem to be altered by the permutation of the columns of the original matrix Σ. The Frobenius norm of the error is equal to 9.9.
In this situation $\widehat{\boldsymbol{\Sigma}}^{-1/2}$ is still available. The matrix $\widehat{\boldsymbol{\Sigma}}^{-1/2}\boldsymbol{\Sigma}\widehat{\boldsymbol{\Sigma}}^{-1/2}$, which is displayed in Figure , should be close to the identity matrix:
The associated Frobenius norm $||\widehat{\boldsymbol{\Sigma}}^{-1/2}\boldsymbol{\Sigma}\widehat{\boldsymbol{\Sigma}}^{-1/2}-\textrm{Id}_q||=$ 6.
All the values of the Frobenius norms are quite close meaning that our methodology is efficient even when the parameters are unknown and when the columns and rows have to be permuted in order to make the block structure appear.