[SciPy-User] np.corrcoef ddof is redundant?

Alistair Miles alimanfoo at googlemail.com
Tue Mar 10 19:09:24 EDT 2015


Thanks for the responses, glad to know I'm not going crazy.

Cheers,
Alistair.

On Tuesday, 10 March 2015, Matthew Brett <matthew.brett at gmail.com> wrote:

> Hi,
>
> On Tue, Mar 10, 2015 at 9:27 AM, Sturla Molden <sturla.molden at gmail.com
> <javascript:;>> wrote:
> > Alistair Miles <alimanfoo at googlemail.com <javascript:;>> wrote:
> >
> >> I'm trying to calculate correlation coefficients and looking at the
> >> np.corrcoef function. It has bias and ddof arguments, however when I try
> >> different values of ddof with test data the results are always the same,
> >> i.e., changing ddof has no effect. From some back-of-the-envelope
> algebra I
> >> reckon the n/(n-ddof) normalisations should get cancelled out when
> >> calculating correlation coefficients from a covariance matrix, and
> >> therefore the ddof (and bias) arguments to np.corrcoef are redundant.
> >>
> >> I'd be very grateful if someone could verify this is true or tell me if
> >> I've missed something.
> >
> > You are right. It should cancel out or np.corrcoef would be wrong. The
> > sample size does not go into the Pearson product-moment correlation.
>
> Oh dear - that's embarrassing.
>
>
> https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient
>
> I guess we should deprecate the 'bias' and 'ddof' input arguments asap.
>
> Cheers,
>
> Matthew
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org <javascript:;>
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


-- 
Alistair Miles
Head of Epidemiological Informatics
Centre for Genomics and Global Health <http://cggh.org>
The Wellcome Trust Centre for Human Genetics
Roosevelt Drive
Oxford
OX3 7BN
United Kingdom
Web: http://purl.org/net/aliman
Email: alimanfoo at gmail.com
Tel: +44 (0)1865 287721
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150310/c550248f/attachment.html>


More information about the SciPy-User mailing list