From: Avengeline on
I am confused. Anyone can tell me what is the difference between corr and corrcoef?
From: Peter Perkins on
On 3/8/2010 1:05 PM, Avengeline wrote:
> I am confused. Anyone can tell me what is the difference between corr
> and corrcoef?

For the purposes of linear correlation, no difference except that corr will calculate a "cross correlation" between two sets of variables. So e.g., in the simplest case, when x and y are both column vectors, corrcoef returns a 2x2 corr matrix, [1 rho; rho 1], while corr returns a scalar corr coef, rho.

But also, corr can compute both Spearman's and Kendall's _rank_ correlations.
From: Avengeline on
Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hn3grf$68a$1(a)fred.mathworks.com>...
> On 3/8/2010 1:05 PM, Avengeline wrote:
> > I am confused. Anyone can tell me what is the difference between corr
> > and corrcoef?
>
> For the purposes of linear correlation, no difference except that corr will calculate a "cross correlation" between two sets of variables. So e.g., in the simplest case, when x and y are both column vectors, corrcoef returns a 2x2 corr matrix, [1 rho; rho 1], while corr returns a scalar corr coef, rho.
>
> But also, corr can compute both Spearman's and Kendall's _rank_ correlations.

Thanks. So, corr is actually computing Pearson's Linear Coefficient Correlation right?
From: Peter Perkins on
On 3/8/2010 8:22 PM, Avengeline wrote:
> Thanks. So, corr is actually computing Pearson's Linear Coefficient
> Correlation right?

>> help corr
CORR Linear or rank correlation.
[snip]
Parameter Value
'type' 'Pearson' (the default) to compute Pearson's linear
correlation coefficient, 'Kendall' to compute Kendall's
tau, or 'Spearman' to compute Spearman's rho.


From: Avengeline on
Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hn5c4d$gmm$1(a)fred.mathworks.com>...
> On 3/8/2010 8:22 PM, Avengeline wrote:
> > Thanks. So, corr is actually computing Pearson's Linear Coefficient
> > Correlation right?
>
> >> help corr
> CORR Linear or rank correlation.
> [snip]
> Parameter Value
> 'type' 'Pearson' (the default) to compute Pearson's linear
> correlation coefficient, 'Kendall' to compute Kendall's
> tau, or 'Spearman' to compute Spearman's rho.
>

Meaning to say..
for data A = [....] and B= [..]

corr(A,B) <-- this is pearson's linear correlation coefficient?

if for kendall...

is it.. corr(A,B,'Kendall')?