我是Stack Overflow的忠实拥护者,并且可以肯定我的问题会在这里得到解答。我正在使用Scipy进行线性回归。但是在一组特定的输入下,我没有得到正确的输出。(Python 2.5,SciPy 0.10.1 Windows 7 32位)
from scipy.stats import linregress
from numpy import arange
x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,2,0,0,2]
y = arange(1,36)
s,i,r,p,st = linregress(x,y)
Run Code Online (Sandbox Code Playgroud)
此处s的值为9.241573,但Excel报告斜率为0.026。
我想念什么吗?救命。