On Wed, Mar 4, 2009 at 10:54 AM, per freem <perfr...@gmail.com> wrote:

> hi all,
>
> i managed to do linear regression on two vectors x, and y using
> linalg.lstsq. what i can't figure out is how to compute the R-squared value
> - the correlation of the two vectors - in matplotlib. can someone please
> point me to the right function? thank you.



You should use numpy rather than matplotlib.  R-squared is the square of the
correlation coefficient, so

In [162]: c = np.corrcoef(x, y)[0,1]

In [163]: r2 = c**2
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to