Problem calculating a empirical covariance matrix
이전 댓글 표시
Hello,
I am trying to compute an empirical covariance matrix from a sample matrix. I need to use it later on with other function which calls chol. The data is 16 dimensional. I tried the following:
D = size(SAMPLE_MATRIX,2); COV = zeros(D,D); for i = 1:D COV = COV + SAMPLE_MATRIX(:,i)*SAMPLE_MATRIX(:,i)'; end COV = COV/D;
However, COV is not positive definite at the end (it has a large first positive eigenvalue and then negative eigenvalues of the order exp(-20)). Consequently I cannot use this matrix as a covariance matrix in the chol (or cholcov) function.
I tried the most obvious cov(SAMPLE_MATRIS'), with the same result. Am I doing something wrong, or there is a problem in how matlab computes covariances???
답변 (1개)
Mohammad Sayyafzadeh
2012년 2월 14일
0 개 추천
I have a same problem.
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!