[SciPy-user] SciPy.Stats.linregress question

Brandon C. Nuttall bnuttall@uky....
Sat Apr 14 16:18:41 CDT 2007


I have a question about the least squares linear regression module in scipy.stats.linregress. The standard error of the estimate returned is the population estimate not the sample estimate. Shouldn't this be an estimate for the sample (i.e., the degrees of freedom should be n-2 where n is the sample size)? That's not really a my question. My question is, should there be a parameter for this and similar routines that specifies whether you want a population or sample estimate?

So, for example, using data from http://onlinestatbook.com/chapter12/accuracy.html, you can back out the sample standard error of the estimate:

>>> ================================ RESTART ================================
>>> from scipy.stats import linregress
>>> from math import *
>>> online = [[1.0, 1.0], [2.0, 2.0], [3.0, 1.3], [4.0, 3.75], [5.0, 2.25]]
>>> slope,intercept,r,twotail,stderr = linregress(online)
>>> print "Population stderr:",stderr
Population stderr: 0.747094371549
>>> sample = sqrt((stderr*stderr*len(online))/(len(online)-2))
>>> print "Sample stderr:",sample
Sample stderr: 0.964494686351


Brandon Nuttall
Brandon C. Nuttall
859-257-5500 ext 174

More information about the SciPy-user mailing list