[R] loess
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Jan 5 00:45:15 CET 2007
On Thu, 4 Jan 2007, Jukka Nyblom wrote:
> Hi,
>
> I have tried
>
> > for (i in 1:100) L[,i] <- loess((i = =(1:100))~I(1:100), span=.5,
> degree=1)$fit
>
> to create a matrix which gives me the smoothing weights (correctly as
> far as I have experienced), eg.
>
> > yhat <- loess(y~I(1:100), span=.5,degree=1)$fit
> > yhat[30]
> [1] -0.2131983
> > L[30,]%*%y
> [,1]
> [1,] -0.2131983
>
> But, L[30,] has 56 nonzero coefficients, not 50 that I expect with span
> = 0.5. Actually the number of nonzero elements on rows varies being 49,
> 50, 55 or 56.
>
> Does anyone know why?
loess is a complicated algorithm, and you need to study the background
references in depth to fully understand it. In particular, the default is
not to do direct fitting (as I guess you are assuming) but interpolation.
See ?loess.control.
Most descriptions, including the help page, are simplifications.
> Jukka Nyblom
--
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