Negative eigenvalues in covariance matrix

In summary, the conversation revolves around running the factoran function in MATLAB on a large matrix of daily stock returns. The issue is that the function requires the data to have a positive definite covariance matrix, but the data has many very small negative eigenvalues due to floating point errors. The suggested solution is to add a small constant value to the diagonal elements of the covariance matrix, known as diagonal loading or Tikhonov regularization, to eliminate the negative values and increase the noise floor in the data. While there is no built-in option to do this in MATLAB, it can be achieved by hacking the function. The outcome of this approach is yet to be determined.
  • #1
BWV
1,465
1,781
Trying to run the factoran function in MATLAB on a large matrix of daily stock returns. The function requires the data to have a positive definite covariance matrix, but this data has many very small negative eigenvalues (< 10^-17), which I understand to be a floating point issue as 'real' covariance matrices are positive semi-definite. Does not make a difference whether or not I subtract the market return (which reduces the correlation). Any thoughts, I can find options to 'fix' the cov matrix, but nothing to tweak the data prior to calculating the cov matrix
 
Technology news on Phys.org
  • #2
Add a small constant value σ2 to the diagonal elements of your covariance matrix. This has the effect of increasing the noise floor in your data, eliminating the negative values arising from numerical errors. The smallest eigenvalues will now take the value σ2 (approximately--but that's a topic for another thread). Choose σ2 large compared to 1e-17 but small compared to the eigenvalues of interest. If your eigenvalues of interest are of order >=1, for instance, then σ2=1e-10 will suffice without affecting the validity of your data. This is known in the statistical signal processing literature as diagonal loading and in the mathematics literature as Tikhonov regularization.
 
  • Like
Likes sysprog, FactChecker and BWV
  • #3
Thanks, afraid of that, will have to hack the MATLAB function to do this, surprised there is not an option on the cov function or another built-in function to do this. Its just something I am playing around with, so not sure if I will invest the time
 
  • Like
Likes sysprog
  • #4
Let us know how it turns out!
 

1. What are negative eigenvalues in a covariance matrix?

Negative eigenvalues in a covariance matrix indicate that there is a negative correlation between two variables. This means that as one variable increases, the other variable decreases.

2. Why are negative eigenvalues a concern in a covariance matrix?

Negative eigenvalues can cause issues in statistical analyses such as principal component analysis (PCA) and linear discriminant analysis (LDA). They can also affect the stability and accuracy of the results obtained from these analyses.

3. How do negative eigenvalues affect the interpretation of a covariance matrix?

Negative eigenvalues can lead to incorrect interpretations of the covariance matrix. They can also result in misleading conclusions about the relationships between variables.

4. What are some potential causes of negative eigenvalues in a covariance matrix?

Negative eigenvalues can occur due to multicollinearity, where two or more variables are highly correlated with each other. They can also arise from data with large outliers or from a small sample size.

5. How can we deal with negative eigenvalues in a covariance matrix?

There are several methods for dealing with negative eigenvalues, including data transformation, removing highly correlated variables, and using regularization techniques. It is also important to examine the data and the analysis methods carefully to ensure that negative eigenvalues do not affect the results.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
862
  • Quantum Physics
Replies
27
Views
2K
Replies
5
Views
915
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
882
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
962
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
4K
  • Linear and Abstract Algebra
Replies
1
Views
8K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
Back
Top