[SciPy-User] obtaining residuals from linear regression?

josef.pktd@gmai... josef.pktd@gmai...
Fri Aug 26 11:29:28 CDT 2011


On Fri, Aug 26, 2011 at 12:06 PM, Jeremy Gray <jrgray@gmail.com> wrote:
> Hi,
>
> I'm new to scipy, and hope the answer is not trivial. I've searched the
> archives, googled, and looked at documentation for linalg.lstsq()
> numpy.polyfit(), and scipy.stats.linregress(), but it has not answered my
> question.
>
> my goal is to linearly adjust a set of observations (Y) for nuisance
> variables (X1 ... Xn), so I can use the adjusted Y values in further
> computations. One way to achieve what I want is to do a linear regression,
> regressing out the nuisance variables, and saving the residuals (being the
> part of Y that's not explained by X).
>
> I see the option full=True returns residuals, but its the sum of the
> residuals, whereas I am after the actual residuals on a case by case basis.
>
> is there an option to get the raw residuals? it would save me computing them
> again.

for a full answer for the linear (in parameter) case

http://statsmodels.sourceforge.net/generated/scikits.statsmodels.regression.linear_model.OLS.html

http://statsmodels.sourceforge.net/generated/scikits.statsmodels.regression.linear_model.RegressionResults.html

Josef

>
> --Jeremy
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


More information about the SciPy-User mailing list