matlab correlation and significant values
matlab, statistics
Solution
>> [R,p] = corrcoef(dat,dat2,'rows','pairwise')
R =
1.0000 -0.3331
-0.3331 1.0000
p =
1.0000 0.3811
0.3811 1.0000
The correlation is -0.3331 and the p-value is 0.3811. The latter is the probability of getting a correlation as large as -0.3331 by random chance, when the true correlation is zero. The p-value is large, so we cannot reject the null hypothesis of no correlation at any reasonable significance level.
Problem
I have a rather simple question that needs addressing in matlab. I think I understand but I need someone to clarify I'm doing this correctly: In the following example I'm trying to calculate the correlation between two vectors and the p values for the correlation. ``` dat = [1,3,45,2,5,56,75,3,3.3]; dat2 = [3,33,5,6,4,3,2,5,7]; [R,p] = corrcoef(dat,dat2,'rows','pairwise'); R2 = R(1,2).^2; pvalue = p(1,2); ``` From this I have a R2 value of 0.11 and a p value of 0.38. Does this mean that the vectors are correlated by 0.11 (i.e. 11%) and this would be expected to occur 38 % of the same, so 62 % of the time a different correlation could occur?