Negative eigenvalues in covariance matrix

Click For Summary

Discussion Overview

The discussion revolves around the issue of negative eigenvalues in the covariance matrix derived from a large matrix of daily stock returns, particularly in the context of using the factoran function in MATLAB. Participants explore potential solutions to ensure the covariance matrix remains positive definite.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant notes the presence of very small negative eigenvalues in the covariance matrix, attributing this to floating point issues and stating that real covariance matrices should be positive semi-definite.
  • Another participant suggests adding a small constant value σ2 to the diagonal elements of the covariance matrix to eliminate negative eigenvalues caused by numerical errors, describing this method as diagonal loading or Tikhonov regularization.
  • A participant expresses concern about needing to modify the MATLAB function to implement the suggested solution, indicating uncertainty about the investment of time in this adjustment.
  • A later reply encourages the participant to share the outcome of their efforts.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to address the negative eigenvalues, and multiple viewpoints regarding potential solutions are presented.

Contextual Notes

Participants do not fully explore the implications of the proposed solutions or the specific conditions under which they might be applicable, leaving some assumptions and dependencies on definitions unresolved.

Who May Find This Useful

Individuals working with covariance matrices in statistical analysis, particularly in finance or data science, may find the discussion relevant.

BWV
Messages
1,665
Reaction score
2,009
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
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   Reactions: sysprog, FactChecker and BWV
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   Reactions: sysprog
Let us know how it turns out!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
Replies
11
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
9K