Re: [R] coefficients of each local polynomial from loess() or locfit()

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Mon 08 Jan 2007 - 19:29:51 GMT

Liu, Delong (NIH/CIT) [C] <liud2 <at> mail.nih.gov> writes:

> Instead, I am more interested in obtaining the
> coefficient estimates of local polynomial from loess(). Is it
> straightforward to modify loess() so that the coefficient estimates can
> be put into the return list of loess()?

No need to change loess.
>
> cars.lo <- loess(dist ~ speed, cars)
> str(cars.lo)
>
> List of 17
...
> $ kd :List of 5
> ..$ parameter: Named int [1:7] 1 50 2 19 11 1049 849
> .. ..- attr(*, "names")= chr [1:7] "d" "n" "vc" "nc" ...
> ..$ a : int [1:19] 1 1 1 1 1 1 1 0 0 0 ...
> ..$ xi : num [1:19] 15 12 19 9 13 17 20 0 0 0 ...
> ..$ vert : num [1:2] 3.90 25.11
> ..$ vval : num [1:22] 5.71 1.72 96.46 10.88 41.21 ...

As I showed you, they are in cars.lo$kd, but you must dig into the source code to find out how they are used. And after reading Brian Ripley's warning, I would recommend that you don't try it if you are not sure how "extract" these.

Dieter



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 Wed Jan 10 03:03:12 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 Tue 09 Jan 2007 - 16:30:31 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.