How to calculate correlation coefficient between three dimensional matrix ?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have two gridded matrix, matrix1 and matrix2 having latitude, longitude and months (180 x 360 x 12). I have calculated correlation coefficient and p-value between both matrices using corrcoeff function. Than I assigned three values in correlation matrix, 1 for positive correlation (p-value is <0.05), -1 for negative correlation (p-value is <0.05) and 0 for rest of the positive/negative correlation which have insignificant (>0.05) p-value. I wrote following code for correlation coefficient calculation:
for y = 1:180,
for x = 1:360,
A = matrix1(y,x,:);
B = matrix2(y,x,:);
[C,P] = corrcoef(A,B);
m = C(1,2);
n = P(1,2);
map1(y,x) = m;
pval(y,x) = n;
if map1 > 0 & pval <= 0.05;
cormap(y,x) = 1;
elseif map1 < 0 & pval <= 0.05;
cormap(y,x) = -1;
else
cormap(y,x) = 0;
end;
end;
end;
basically I want want to find significant and insignificant correlation values in correlation matrix. But using above code final output cormap is showing 0 value in entire matrix. I am not getting where I am wrong. Can anyone help me to solve this problem ?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!