A Short Note on Resolving Singularity Problems in Covariance Matrices

In problems where a distribution is concentrated in a lower-dimensional subspace, the covariance matrix faces a singularity problem. In downstream statistical analyzes this can cause a problem as the inverse of the covariance matrix is often required in the likelihood. There are several methods to overcome this challenge. The most well-known ones are the eigenvalue, singular value, and Cholesky decompositions. In this short note, we develop a new method to deal with the singularity problem while preserving the covariance structure of the original matrix. We compare our alternative with other methods. In a simulation study, we generate various covariance matrices that have di ﬀ erent dimensions and dependency structures, and compare the CPU times of each approach.


Introduction
The high dimensional variances' structures are commonly observed in many mathematical sciences from linear algebra and statistical calculations to financial and genomic data analysis.For instance in multivariate statistical analysis, the major concern is either the hypothesis testing or the inference of population parameters that are based on mainly high dimensional matrices where the covariances are typically used in the associated expressions (Kutner et al., 2005).Alternatively in microarray studies within the genomic data analysis (Emmert-Streib & Dehmer, 2008) we need to deal with the intensities from hundreds of genes simultaneously in which the mean and variance estimates of genes are described by high dimensional matrices.When working on such underlying high dimensional covariance structures, we may face with the singularity problem if the distribution of the dataset is concentrated on a lower-dimensional subspace.In other words there are linear relationships between columns or rows of the covariance matrix, resulting in zero determinant in its calculation.This also means that the inverse of the underlying matrix becomes intractable, which leads to a computational problem in the likelihood.For instance when we work on a singular covariance matrix and the distribution function of the data is expressed via this matrix such as the density of the multivariate normal distribution, the associated likelihood function becomes intractable.
There are a number of methods to unravel the underlying challenge.The most well-known ones can be listed as the eigenvalue decomposition, singular value decomposition, and the Cholesky decomposition.In this study, we suggest an alternative method for these major approaches to solve the singularity problem.We perform our suggested method in different covariance matrices with distinct dimensions and singularity proportions and we compare our results with the other well-known methods in terms of computational time.For the evaluation, we use Monte Carlo methods.In Section 2 we describe the problem.In Section 3 we initially explain each method explicitly and represent our motivation for proposing a new approach against the singularity.Then in Section 4 we report our comparative analyzes and interpret the results.Finally in Section 5, we summarize the outcomes and discuss the future works.

Motivation
In finance, genomics and several other fields, the aim is to explain the change in state of a stock, a gene or other variable by applying a deterministic drift term plus a stochastic diffusion term, involving a Brownian motion.In inferring multivariate stochastic differential equations (Golightly & Wilkinson, 2005;Purutc ¸uoglu & Wit, 2008) of the form the aim is to obtain estimates of the drift μ and diffusion matrix σ.The inference problem of μ is relatively straightforward, whereas the inference for σ can involve computational problems.In fact, especially in high-dimensional problems, the term σ(X t , t) can be computationally singular, or even exactly singular for particular values of X t and t.In practice, this can occur when the number of financial instruments increases or when the number of genes included in the model becomes large.Also as the system converges to its stationary distribution, we are often faced with the problem of linear dependency between the state space quantities that causes a singularity in diffusion matrix.For instance in stochastic volatility model (Chib et al., 2006) as well as financial forecasting analysis (Andersen et al., 1999), also high dimensional inference problems in biochemical networks (Purutc ¸uoglu & Wit, 2008) or stochastic simulation of large biological systems (Purutc ¸uoglu & Wit, 2006) such types of problems are typically observed.
Although there are a number of alternative approaches to deal with the singularity problem, none of them explicitly deals with the actual structure of the linear relationship between the states.Particularly, in Bayesian inference, we may have partial observations of some states and the information about all the states should be used for inference about diffusion.In that case, simply focussing on a non-singular subspace of the states, may result in information loss.Instead, we propose a method that considers a lower dimensional, non-singular diffusion submatrix and explicitly models the linear relation between its dependent and independent terms.

Method
The singularity problem in covariance-like matrices is one of the common challenges in the algebraic calculations.
A number of methods exists to unravel this problem.In the first parts of this section, we briefly review current well-known approaches.Then we state an ongoing problem in the calculation of singularity and finally describe our proposal.

Eigenvalue Decomposition
Considering that A is a symmetric matrix, U denotes a matrix that includes the set of eigenvectors of A, and the diagonal matrix Λ stores the eigenvalues of A in the diagonal elements, we can write the following equality for every A, U, and Λ.

AU = UΛ.
(2) Hereby the eigen-value decomposition of A can be found by Accordingly the square root of A can be calculated by taking the square root of Λ via If A is non-negative semi-definite, then the eigenvalue decomposition of this matrix always exists and the associated eigenvalues are always positive or zero.The correlation, covariance, and cross-product matrices can be given as examples of such types of matrices (Healy, 1986).In this decomposition, the structure of the matrix can disappear if the original matrix is singular and we need to convert this matrix into nonsingular form by reducing the dimension (Johnson & Wichern, 2002;Rencher, 2002).

Singular Value Decomposition
Let A be an (m × n) rectangular matrix which can be written as a product of three matrices, namely, an (m × m) orthogonal matrix U, an (m × n) diagonal matrix Λ, and the transpose of an (n × n) orthogonal matrix V.Here Λ is a matrix containing singular values in diagonal elements with descending order.
Accordingly the singular value decomposition (SVD) of A can be declared in terms of U, Λ, and V by where the columns of U and the columns of V are orthogonal eigenvectors of AA T and A T A, respectively.Thus the square root of A can be written via Similar to the eigenvalue decomposition, the structure of the original matrix A can change if A is reconstructed in order to convert the matrix from singular to nonsingular form (Johnson & Wichern, 2002;Rencher, 2002).

Cholesky Decomposition
If A denotes a symmetric and positive definite matrix, the Cholesky decomposition of A can be found by an upper triangular matrix U having strictly positive diagonal entries such that Here the matrix U is called the square root of A. If A is also symmetric, then U T = U, hereby, A = UU.But if A is positive semi-definite, i.e. some eigenvalues are zero, we use a numerical tolerance in the decomposition of A. In this approach, similar to its previous alternatives, it cannot preserve the original structure of the matrix when the singularity problem is solved by this decomposition and a new nonsingular matrix is defined under the original dimension of A (Johnson & Wichern, 2002;Rencher, 2002).

New Method
We suggest a new updating regime to solve the singularity problem of a covariance matrix A, which enables us to reconstitute the covariance structure by working with a lower dimensional matrix A * and its linear recovery matrix B. Let A be a (n × n) symmetric matrix of rank p < n.Without loss of generality, assume that the first p columns are linearly independent.In practice, this is not a restriction, as the underlying states X (cf.Section 2) can always be reordered to achieve this.This means that the matrix A can be written as where A 1 is an (n × p) and A 2 an (n × (n − p)) matrix, for which the latter can be written as for a (p × (n − p)) matrix B, since A 2 is linearly dependent on A 1 by the assumption of rank p of A. In other words, for p dimensional identity matrix I p .By decomposing A 1 in an upper (p × p) dimensional and a lower ((n − p) × p) dimensional matrix, A 1 = [A 11 A 12 ] T , we can write A as Given the symmetry of A, we get that A T 12 = A 11 B and so The crucial element of the decomposition in ( 8) is that the distribution can be described by means of the (p× p) nonsingular matrix A 11 , whereas the matrix B of the linear coefficients allows us to reconstitute the linearly dependent elements.The steps of the algorithm for matrix A can be also listed as below.

1) Each linearly dependent column A = [A 1
A 2 ] is identified by checking the columns of A from left to right.
2) The dependent columns, A 2 , totally p, are described as the linear combination of independent columns.
3) A new (n − p) × (n − p) dimensional covariance matrix A * is defined by eliminating p dependent columns and rows from A n×n .
For example, if this method is used in MCMC (Monte Carlo Markov Chain) inference of stochastic differential equations, a singular diffusion matrix can be first transformed into a non-singular and lower dimensional form and the diffusion matrix can be updated under such lower dimensional space.Then the updated and independent columns are re-applied in the generation of the omitted columns, which are eliminated previously due to the dependency, by using the linear relations encoded in matrix B.

Numerical Example
As an implementation of the new method we give the following numerical example by applying Equation (1).Let the total number of substrates in the system be 3, n = 3, and the time step dt is taken as dt = 0.1 unit.Also the drift term μ and diffusion matrix σ set to μ = [3 5 7] and respectively.By controlling the column of σ from left to right, we see that the second column of σ is four times of its first column, thereby the corresponding B vector which shows the linear dependence between the second column and the remaining columns is B = [4 0].In order to get a non-singular submatrix, we decompose the diffusion matrix σ as where Since σ 2 is linearly dependent on σ 1 , the following equality is satisfied.
Hence we can generate the non-singular and lower dimensional matrix σ * by σ * = σ 11 .So in order to obtain Δ j = σ * 1/2 × dB t according to Equation (1), resulting in the calculation of the diffusion part for the independent terms changed by Brownian motion, we generate two random values from normal distribution with mean zero and variance as the time step 0.1, i.e. dB t ∼ N(0, 0.1).Then we multiply them by σ * 1/2 .The values of dB t are found as dB t = [−0.524− 0.251] from the R programme language with rnorm function.Accordingly Δ j associated to the first and third substrates are obtained by Δ j=1,3 = σ * 1/2 × dB t = (−1.048,−0, 753).On the other hand for the update of the dependent term, i.e. the corresponding value of the second term, we calculate And finally the change in state based on the diffusion model is computed as follows.
In the further analysis, for instance, if the result is used for a simulation purpose, this change is applied for the update of the system in the next state.Hereby the new state X new can be generated by adding the current state X old to the change ΔX t , i.e.X new = X old + ΔX t .

Simulation Study
In order to compare the performance of each method, we use simulated datasets and generate different covariance matrices which are symmetric and singular.In the matrix generation, firstly, we produce independent columns one by one from left to right.Then these columns are used to construct the linearly dependent columns.From the empirical studies we observe that the location of dependent and independent columns does not make any difference in our method since whatever the order of the dependent and independent columns, we always check each column of matrices from left to right sequentially and compare whether each proposal column is linearly dependent on previous columns.Hereby to obtain the symmetric matrix from the underlying singular matrix, the covariance matrix is calculated.These matrices are generated under two different scenarios.In the first plan, we generate matrices whose 80 % of the columns are independent and the remaining 20 % of columns has linearly dependency.Then in the second scenario, we use matrices whose 80 % of columns are linearly dependent, and the remaining ones are taken as independent.Under both scenarios, we apply matrices owing different dimensions, namely, 50 by 50, 100 by 100, 400 by 400, 500 by 500, and 750 by 750.In all computational works, we carry in the R programming language version 2.10.0 and execute our codes on Core 2 Duo 2.0 GHz processor.
To compare the performance of alternative methods with our proposal approach, we check the CPU (Central Processing Unit) times.In order to estimate the CPU of each method, we iterate the algorithm 1000 times for each matrix structure with distinct dimensions and take the mean of the underlying Monte Carlo outputs.However because of the time restriction and computational inefficiency, we iterate the algorithm 250 times for the matrix dimension 750 by 750.In these calculations, we record the time only to decompose singular matrices for eigenvalue, sigular value, and Cholesky methods, and keep the time to both decompose the singularity and detect the linear relationship between columns for our suggested approach.
Table 1 shows CPU's of matrices with 4 different sizes under the first scenario.From the results it is seen that although the new method has more computational steps, there is no difference in CPU's for low like (50×50) and moderately high dimensional-matrices such as the matrices under (100×100) and (400×400) dimensions.Whereas if we consider very high dimensions like (500×500) or (750×750), the new method slightly looses more time with respect to other methods under both scenarios.For instance the CPU's for the (750×750) matrix under the first scenario with 250 iterations are 0.008, 0.008, 0.002, and 2.147 for the eigenvalue, singular value, Cholesky, and our new method, respectively.Similarly the CPU's for this matrix-dimension under the second scenario are found as 0.014, 0.014, 0.003, and 0.785 for the same order of decomposition's methods.On the other hand when we increase the number of dependent columns under the same dimension as seen in Table 2, we observe that all methods use less CPU.However the CPU of our method decreases more sharply and its becomes the most efficient method in computation when both dependency and dimension are big.This findings can be interpreted that our new method can be mainly preferable when the singularity becomes a severe challenge for the matrix.

Conclusion and Discussion
In this study, we have developed a new method to deal with the singularity problem of covariance matrix.We have explained the most well-known methods that are performed to overcome this challenge such as the eigenvalue, singular value, and Cholesky decompositions.Moreover we have generated different covariance matrices with distinct dimensions and dependency structures.Then we have used these matrices to check the performance of both our new method and the listed benchmark approaches in terms of their computational times.These computational times cover the decomposition of matrix with all suggested methods and also the time to find the linear relations of the columns for only our new method.
From the results we have observed that all methods have the same CPU's for low and moderately high dimensional

Table 1 .
Comparison of total CPU's under 1000 Monte Carlo runs for eigenvalue, singular value, and Cholesky decompositions with new method based on different dimensional matrices under the first scenario

Table 2 .
Comparison of total CPU's under 1000 Monte Carlo runs for eigenvalue, singular value, and Cholesky decompositions with new method based on different dimensional matrices under the second scenario