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

Sturla Molden sturla.molden at gmail.com
Tue Mar 10 12:27:40 EDT 2015


Alistair Miles <alimanfoo at googlemail.com> 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.

Sturla








> Thanks,
> Alistair
> 
> --
> Alistair Miles
> Head of Epidemiological Informatics
> Centre for Genomics and Global Health <<a href="http://cggh.org">http://cggh.org</a>>
> The Wellcome Trust Centre for Human Genetics
> Roosevelt Drive
> Oxford
> OX3 7BN
> United Kingdom
> Web: <a href="http://purl.org/net/aliman">http://purl.org/net/aliman</a>
> Email: alimanfoo at gmail.com
> Tel: +44 (0)1865 287721
> 
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> <a
> href="http://mail.scipy.org/mailman/listinfo/scipy-user">http://mail.scipy.org/mailman/listinfo/scipy-user</a>




More information about the SciPy-User mailing list