MATLAB Answers

p values from correlation matrix using nancov

13 views (last 30 days)
JacquelineK on 21 Sep 2017
Commented: JacquelineK on 23 Sep 2017
I have a matrix A 225x13 containing missing values.
Because of the missing values I can not use corrcoef for my correlation matrix. Nor can I use [r,p].
So my current code looks like this:
Cov_A = nancov(A)
R = corrcov(Cov_A)
With corrcoef it would definetely be easier to just:
[r,p] = corrcoef(B);
[i,p] = find(p<0.05);
How do I get the same results, meaning r and p with "corrcov"? Or is it even possible to get pvalues with corrcov??


Sign in to comment.

Accepted Answer

Brendan Hamm
Brendan Hamm on 22 Sep 2017
The corrcoef function accepts Name-Value pair inputs to handle missing data.
[r,p] = corrcoeff(B,'rows','complete')
[r,p] = corcoeff(B,'rows','pairwise')

More Answers (0)