Re: corr & corrcoef
- From: Peter Perkins <Peter.PerkinsRemoveThis@xxxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 10:07:10 -0400
Lorenzo Guerrasio wrote:
So the only difference is in how P is calculate?
x=0:0.1:10;
y=x.^2+rand(1,101);
plot(x,y)
X=[x(:),y(:)];
[a,b]=corrcoef(X)
[c,d]=corr(X)
b and d are different: diag(b)=1 1, diag(d)=0 0
Why is that?
Lorenzo, I'm curious what you think the right answer is, and why it would be useful.
CORRCOEF only accepts a single input, thus the diagonal elements necessarily correspond to a correlation of a variable with itself, which necessarily is 1, and therefore the p-value is 0. CORR allows "cross correlation" (although you aren't using that syntax), and so the diagonal elements could be correlations between two variables, and if the two vectors of values happen to be identical, then the correlation is 1, but the p-value is 0.
.
- Follow-Ups:
- Re: corr & corrcoef
- From: Lorenzo Guerrasio
- Re: corr & corrcoef
- References:
- corr & corrcoef
- From: Lorenzo Guerrasio
- Re: corr & corrcoef
- From: Peter Perkins
- Re: corr & corrcoef
- From: Lorenzo Guerrasio
- corr & corrcoef
- Prev by Date: Re: Zernike decomposition
- Next by Date: Re: Returning the maximum and its corresponding cells in the other matrix.
- Previous by thread: Re: corr & corrcoef
- Next by thread: Re: corr & corrcoef
- Index(es):
Relevant Pages
|