[R] local regression using loess

Ryan rhafen at purdue.edu
Tue Jul 28 02:25:13 CEST 2009


> >
> > Hi, All,
> >
> > I have a dataset with binary response ( 0 and 1) and some numerical
> > covariates. I know I can use logistic regression to fit the data. But I
> > want
> > to consider more locally. So I am wondering how can I fit the data with
> > 'loess' function in R? And what will be the response: 0/1 or the
> > probability
> > in either group like in logistic regression?
> >
> > -- Neither. Loess is an algorithm that smoothly "interpolates" the data. It
> > makes no claim of modeling the probability for a binary response variable.
> >
> > -- Bert Gunter
> > Genentech Nonclinical Statistics
> >
> > Thank you,
> > Cindy
> >
> >        [[alternative HTML version deleted]]
> >

Actually, loess is much more than an "interpolant".  I wouldn't 
even call it that.  It is a local regression  technique that comes 
with all the equipment you get in classical regression.  But it 
is meant for normal-like errors, which is not what you have.

I would recommend that you take a look at the locfit package.  
It fits local likelihood models.  I've never tried it with binary data, 
but if y is your 0/1 response and x is a covariate, you might try 
something like:

locfit(y ~ x, ..., family="binomial")

If you have a good library at your disposal, try picking up Loader's 
book "Local Regression and Likelihood".




More information about the R-help mailing list