Covariance matrix not always positive define

2 visualizaciones (últimos 30 días)
Gina Carts
Gina Carts el 21 de Mzo. de 2019
Comentada: Adam el 21 de Mzo. de 2019
I have used the cov Matlab function to calculate the covariance matrix.
I calculate the covariance matrix inside a loop and this stop by giving me the error "Error using iwishrnd (line 41) Covariance matrix must be symmetric and positive definite."
I printed the covariance matrix to see how it looks like and basically after the second calculation of the covariance the program stopped. Is there any way to control the covariance matrix in order to be always positive define?
covar =
1.1658 0.6780 -0.0203 -0.1593 -0.0339
0.6780 8.0017 -0.3713 0.0057 -0.3568
-0.0203 -0.3713 1.0419 -0.1423 -0.0006
-0.1593 0.0057 -0.1423 1.1528 0.0454
-0.0339 -0.3568 -0.0006 0.0454 0.8498
covar =
1.3151 0.1604 0.1350 0 0
0.1604 1.5119 -0.2529 0 0
0.1350 -0.2529 0.7174 0 0
0 0 0 0 0
0 0 0 0 0
  1 comentario
Adam
Adam el 21 de Mzo. de 2019
You can often get away with adding a small value to the leading diagonal, but as with anything that changes your data to avoid issues like dividing by zero, it needs to be carefully considered and may not always work.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by