Negative eigenvalues in covariance matrix

Click For Summary
SUMMARY

The discussion centers on addressing negative eigenvalues in covariance matrices when using the factoran function in MATLAB on stock return data. The presence of small negative eigenvalues, attributed to floating point inaccuracies, necessitates a solution to ensure the covariance matrix is positive definite. A recommended approach is to apply diagonal loading by adding a small constant value σ2 to the diagonal elements of the covariance matrix, effectively mitigating numerical errors. This technique, known as Tikhonov regularization, allows for the preservation of data integrity while resolving the issue of negative eigenvalues.

PREREQUISITES
  • Understanding of MATLAB programming and functions
  • Knowledge of covariance matrices and their properties
  • Familiarity with eigenvalues and their significance in statistical analysis
  • Concept of diagonal loading in statistical signal processing
NEXT STEPS
  • Research Tikhonov regularization and its applications in data analysis
  • Learn about diagonal loading techniques in covariance matrix estimation
  • Explore alternatives to factoran in MATLAB for factor analysis
  • Investigate methods for handling floating point errors in numerical computations
USEFUL FOR

This discussion is beneficial for data analysts, quantitative researchers, and financial analysts who work with covariance matrices and seek to ensure data integrity in statistical modeling.

BWV
Messages
1,637
Reaction score
1,992
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
1K
  • · 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