[R] Loess Fit

Greg Snow Greg.Snow at imail.org
Tue Nov 24 17:35:34 CET 2009


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Karl Ove Hufthammer
> Sent: Tuesday, November 24, 2009 1:11 AM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Loess Fit
> 
> On Mon, 23 Nov 2009 14:03:11 -0700 Greg Snow <Greg.Snow at imail.org>
> wrote:
> > If you need a function to reproducibly generate predictions, then
> > use loess to generate a set of predictions for a reasonably dense set
> > of x-values, then use approxfun or splinefun to create a function to
> > interpolate for you.  Then this function can give the predictions for
> > various x values.
> 
> Why not use 'predict.loess' (i.e., 'predict' on a loess object)
> directly?
> 
> --
> Karl Ove Hufthammer
> 

Because that would be simple, straight forward, and make sense, and not require knowledge about less obvious functions.

Actually approxfun and splinefun return functions, predict.loess does not.  But since the original poster has multiple x variables, approxfun and splinefun will not work, in another branch I have already suggested that he create his own function using predict.loess.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111




More information about the R-help mailing list