For those who may be interested, this can solve the problem: https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd
Why cov doesn't return a semi definite positive matrix ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mayssa
el 11 de Mayo de 2017
I have a matrix of features and based on that, I need to compute a semi definite positive matrix (covariance matrix) for testing purposes, so I naturally used "cov" but when I tested the semidefinite positiveness of the output, results were not satisfying. Is there another function that can do the job ? or may be another way to compute the desired covariance matrix.
Thank you!
1 comentario
Respuesta aceptada
Matt J
el 11 de Mayo de 2017
Editada: Matt J
el 11 de Mayo de 2017
The non-positive definiteness is probably due to floating point calculation errors. You cannot avoid this if your cov matrix is close to singular. Remove linearly dependent data from your covariance calculations. Or, just set eigenvalues below a certain threshold to zero.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Hypothesis Tests en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!