[SciPy-user] linear regression

jason-sage@creativetra... jason-sage@creativetra...
Wed May 27 08:35:00 CDT 2009

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]), 
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 
     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.



Jason Grout

More information about the SciPy-user mailing list