[SciPy-user] linear regression

jason-sage at creativetrax.com jason-sage at creativetrax.com
Wed May 27 09:35:00 EDT 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]), 
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.

Thanks,

Jason

-- 
Jason Grout



More information about the SciPy-User mailing list