[SciPy-user] linear regression

josef.pktd@gmai... josef.pktd@gmai...
Wed May 27 08:59:22 CDT 2009


On Wed, May 27, 2009 at 9:35 AM,  <jason-sage@creativetrax.com> wrote:
> Is there a recommended way now of calculating the slope of a linear
> regression?  Using the scipy.stats.linregress function gives a
> deprecation warning, apparently because that function uses the
> scipy.mean function:
>
> sage: import numpy
> sage: import scipy.stats
> sage: scipy.stats.linregress(numpy.asarray([4,3,2,1,2,3,4]),
> numpy.asarray([1,2,3,4,3,2,1]))
> /home/jason/download/sage-sage-4.0.alpha0.5/local/lib/python2.5/site-packages/scipy/stats/stats.py:420:
> DeprecationWarning: scipy.stats.mean is deprecated; please update your
> code to use numpy.mean.
> Please note that:
>   - numpy.mean axis argument defaults to None, not 0
>   - numpy.mean has a ddof argument to replace bias in a more general
> manner.
>     scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x,
> axis=0, ddof=1).
>  axis=0, ddof=1).""", DeprecationWarning)
> (-1.0, 5.0, -1.0, 1.9206748078018268e-50, 0.0)
>
>
> This is scipy 0.7.0.
>

I backported a fix for incorrect slopes standard error
(http://projects.scipy.org/scipy/ticket/874)
 together with the switch to using numpy versions of the depreciated
stats function.

However, not all usage of the depreciated functions has been
backported to 0.7.1, but all are (supposed to be) fixed in the trunk
for 0.8.

So, these kind of depreciation warnings in 0.7.0 and 0.7.1 are just
the result of unfinished  conversion to numpy stats functions.

Josef


More information about the SciPy-user mailing list