[R] loess' robustness weights in loess

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 9 17:52:17 CEST 2004


On Fri, 9 Apr 2004, Rafael A. Irizarry wrote:

> hi!
> 
> i want to change the "robustness weights" used by loess. these 
> are described on page 316 of chambers and hastie's "statistical models in S" 
> book as
> 
> r_i = B(e_i,6m)
> 
> where B is tukey's biweight function, e_i are the residulas, and m is the 
> median average distance from 0 of the residuals. i want to 
> change 6m to, say, 3m. 
> 
> is there a way to do this? i cant figure it out from the help files.

Well, they say loess in R is an interface to C/Fortran code, and not the
same code as the S code described in Chambers & Hastie.  I translated the 
C driver routines to R for some added flexibility.

At a quick look, in function simpleLoess() you will find the weights in
object `robust', calculated by Fortran function lowesw.  You could replace
that by a call to an R-level alternative, or play with the Fortran source
code.  You'll have to do what I did way back, and read the source code to
see how it works in detail.

-- 
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