2
$\begingroup$

I've looked into nonparametric regression packages in R and Python and came across two estimation methods that are relevant for my problem (i.e. replicating the semiparametric estimation in Carneiro, Pedro, James J. Heckman, and Edward J. Vytlacil. 2011. "Estimating Marginal Returns to Education." American Economic Review).

The two, seemingly related, nonparametric routines are called local linear regression (LLR) and LOESS (or its predecessor LOWESS). I've searched the web trying to find an answer as to if and how the two differ but haven't been successful.

Secondly, do you have any experience with either LLR or LOESS estimation in Python? I have tried the package PyQt-Fit, but haven't been able to retrieve the residuals which I need for the replication of Carneiro et al.'s (2011) semiparametric estimation.

If you are aware of any good Python package to run LLR or LOESS and have an idea of how to obtain the residuals (post-estimation), please let me know.

I'm grateful for any help!

$\endgroup$
0
$\begingroup$

According to Wikipedia. "Local regression" is equivalently called "Local polynomial regression". Now this is confusing since linear regression is used to estimate a polynomial trendline by including the higher order terms as regressors in the model. There is really no such thing as polynomial regression except in the sense of using linear regression to estimate a polynomial trendline. So for all intents and purposes, it seems the unifying class is called local regression.

In the Wiki it's further noted that LOESS and LOWESS are specific implementations of local regression. They use a combination of adaptive splines and weights to consistently estimate the local trendline in a nonparametric fashion. It should be noted that LOESS and LOWESS are so tremendously popular, you don't often hear of other forms of local regression. I'm sure some esoteric research has covered alternatives, but my hunch is that it didn't take with the community. Friedman's "supersmoother" is apparently such an alternative.

$\endgroup$
0
$\begingroup$

Regarding the second part of my question, "how to implement LOESS in Python" (although StackOverflow might be the better place to post this):

Statsmodels has a wonderful package which does exactly what I was looking for (http://www.statsmodels.org/devel/generated/statsmodels.nonparametric.smoothers_lowess.lowess.html)

The lowess function returns the predicted y values. These can be used to obtain the residuals as follows:

residual = y_observed - y_predicted

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.