[R] Prediction method for lowess,loess,lokerns,lpepa,ksmooth

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 7 17:07:39 CET 2006


On Tue, 7 Feb 2006, Gavin Simpson wrote:

> On Tue, 2006-02-07 at 06:24 -0800, Amir Safari wrote:
>>
>>   Hi Every Body,
>>   I don't know why some regression functions have no related
>> prediction  function. For example lowess, loess, lokerns, lpridge,
>> lpepa, and  ksmooth.
>>   What could help? Is there any global or wrapper function so that can
>> help?
>>   Regards,
>>   Amir Safari
>
> loess() /does/ have a predict method [7]:
>
>> methods("predict")
> [1] predict.ar*                predict.Arima*
> [3] predict.arima0*            predict.glm
> [5] predict.HoltWinters*       predict.lm
> [7] predict.loess*             predict.mlm
> [9] predict.nls*               predict.poly
> [11] predict.ppr*               predict.prcomp*
> [13] predict.princomp*          predict.smooth.spline*
> [15] predict.smooth.spline.fit* predict.StructTS*
>
>   Non-visible functions are asterisked
>
> The other functions (except ksmooth) I can't find in base R 2.2.1-
> patched, so they are likely from contributed packages. As such, you
> should contact the package maintainers for help, to make a feature
> request, or offer your help in writing predict methods for these
> functions.
>
> ?ksmooth states:
>
> Note:
>
>     This function is implemented purely for compatibility with S,
>     although it is nowhere near as slow as the S function. Better
>     kernel smoothers are available in other packages.
>
> So perhaps you could look in the contributed packages section of the
> CRAN website for something that meets your needs?

However, the _only_ thing kernel smoothing does is prediction. As in

  range.x: the range of points to be covered in the output.

n.points: the number of points at which to evaluate the fit.

x.points: points at which to evaluate the smoothed fit. If missing,
           'n.points' are chosen uniformly to cover 'range.x'.

I would suggest rather using packages KernSmooth (ships with R) or sm.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list