Re: [R] loess

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 04 Jan 2007 - 23:45:15 GMT

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Jan 05 10:48:00 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 05 Jan 2007 - 00:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.