Dear All,
I happen to use a lot the module for linear regression included in scipy. I need to get the standard errors on the slope and the intercept and by looking at the help: Help on function linregress in module scipy.stats.stats: linregress(*args) Calculates a regression line on two arrays, x and y, corresponding to x,y pairs. If a single 2D array is passed, linregress finds dim with 2 levels and splits data into x,y pairs along that dim. Returns: slope, intercept, r, two-tailed prob, stderr-of-the-estimate I am a bit puzzled. I have only one entry for the standard error of the estimate. Should I not have two, namely one standard error for the slope and one for the intercept? I presume the one provided here is the one for the slope, but I fear I have misunderstood something. Or to re-phrase my question: how do I get the errors on the estimated slope and intercept with SciPy linregress? Many thanks Lorenzo _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
On Thu, May 15, 2008 at 9:52 AM, Lorenzo Isella
<[hidden email]> wrote: > Dear All, > I happen to use a lot the module for linear regression included in scipy. > I need to get the standard errors on the slope and the intercept and > by looking at the help: > > Help on function linregress in module scipy.stats.stats: > > linregress(*args) > Calculates a regression line on two arrays, x and y, corresponding to > x,y pairs. If a single 2D array is passed, linregress finds dim with 2 > levels and splits data into x,y pairs along that dim. > > Returns: slope, intercept, r, two-tailed prob, stderr-of-the-estimate > > I am a bit puzzled. I have only one entry for the standard error of > the estimate. Should I not have two, namely one standard error for the > slope and one for the intercept? > I presume the one provided here is the one for the slope, but I fear I > have misunderstood something. Yes. The "Standard Error of the Estimate" is the root-mean-square of the residuals. C.f. http://www.tufts.edu/~gdallal/slrout.htm > Or to re-phrase my question: how do I get the errors on the estimated > slope and intercept with SciPy linregress? According to WikiPedia: http://en.wikipedia.org/wiki/Regression_analysis slope, intercept, r, prob2, see = linregress(x, y) mx = x.mean() sx2 = ((x-mx)**2).sum() sd_intercept = see * sqrt(1./len(x) + mx*mx/sx2) sd_slope = see * sqrt(1./sx2) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
> On Thu, May 15, 2008 at 9:52 AM, Lorenzo Isella
>> Or to re-phrase my question: how do I get the errors on >> the estimated slope and intercept with SciPy linregress? On Thu, 15 May 2008, Robert Kern apparently wrote: > According to WikiPedia: http://en.wikipedia.org/wiki/Regression_analysis You can also take a look at: http://code.google.com/p/econpy/source/browse/trunk/pytrix/ls.py hth, Alan Isaac _______________________________________________ SciPy-user mailing list [hidden email] http://projects.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |