<p dir="ltr">On 26 Sep 2013 17:32, <<a href="mailto:josef.pktd@gmail.com">josef.pktd@gmail.com</a>> wrote:<br>
><br>
> On Thu, Sep 26, 2013 at 7:35 AM, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
> > By textbook I mean, users expect corrcoef to use this formula, which<br>
> > is printed in every textbook:<br>
> >   <a href="https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#For_a_sample">https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#For_a_sample</a><br>
> > The vast majority of people using correlations think that "sample<br>
> > correlation" justs mean this number, not "some arbitrary finite-sample<br>
> > estimator of the underlying population correlation". So the obvious<br>
> > interpretation of pairwise correlations is that you apply that formula<br>
> > to each set of pairwise complete observations.<br>
><br>
> This textbook version **assumes** that we have the same observations<br>
> for all/both variables, and doesn't say what to do if not.<br>
> I'm usually mainly interested the covariance/correlation matrix for<br>
> estimating some underlying population or model parameters or do<br>
> hypothesis tests with them.<br>
><br>
> I just wanted to point out that there is no "obvious" ("There should<br>
> be one-- ...") way to define pairwise deletion correlation matrices.</p>
<p dir="ltr">Yeah, fair enough.</p>
<p dir="ltr">> But maybe just doing a loop [corrcoef(x, y) for x in data for y in<br>
> data] still makes the most sense.   Dunno</p>
<p dir="ltr">I'm not 100% sure what the best answer is either, but it seems we agree that these are the only reasonable options:<br>
(1) refuse to give correlations if there are missing values<br>
(2) the pairwise version pandas/R do<br>
(3) maybe something in between (like only including fully complete rows, or giving an option to pick between these)</p>
<p dir="ltr">But the key thing here is that the current behaviour is definitely *wrong* and misleading people, so we better do something about that. (And if no one pops up to fix it maybe we should just remove the function entirely from 1.8, because numerically wrong answers are Serious Business?)</p>

<p dir="ltr">-n</p>