How does predict.loess work?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How does predict.loess work?

Recher She
Dear R community,

I am trying to understand how the predict function, specifically, the
predict.loess function works.

I understand that the loess function calculates regression parameters at
each data point in 'data'.

lo <- loess ( y~x, data)

p <- predict (lo, newdata)

I understand that the predict function predicts values for 'newdata'
according to the loess regression parameters. How does predict.loess do
this in the case that 'newdata' is different from the original data x? How
does the interpolation take place?

Thank you.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How does predict.loess work?

David Winsemius

On Apr 3, 2012, at 4:12 PM, Recher She wrote:

> Dear R community,
>
> I am trying to understand how the predict function, specifically, the
> predict.loess function works.
>
> I understand that the loess function calculates regression  
> parameters at
> each data point in 'data'.
>
> lo <- loess ( y~x, data)

Well, it produces a fitted-value at each point. Whether there are  
parameters at each point might depend on the degree of the fit.

>
> p <- predict (lo, newdata)
>
> I understand that the predict function predicts values for 'newdata'
> according to the loess regression parameters. How does predict.loess  
> do
> this in the case that 'newdata' is different from the original data  
> x? How
> does the interpolation take place?

Type this at your console:

getAnywhere(predict.loess)

And after seeing that an additional functions is called type this:

getAnywhere(predLoess)

And then you will see that you have descended into a C function called  
'C_loess_dfitse'.

>
> [[alternative HTML version deleted]]
--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How does predict.loess work?

glsnow
In reply to this post by Recher She
Run the examples for the "loess.demo" function in the TeachingDemos
package to get a better understanding of what goes into the loess
predictions.

On Tue, Apr 3, 2012 at 2:12 PM, Recher She <[hidden email]> wrote:

> Dear R community,
>
> I am trying to understand how the predict function, specifically, the
> predict.loess function works.
>
> I understand that the loess function calculates regression parameters at
> each data point in 'data'.
>
> lo <- loess ( y~x, data)
>
> p <- predict (lo, newdata)
>
> I understand that the predict function predicts values for 'newdata'
> according to the loess regression parameters. How does predict.loess do
> this in the case that 'newdata' is different from the original data x? How
> does the interpolation take place?
>
> Thank you.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.



--
Gregory (Greg) L. Snow Ph.D.
[hidden email]

______________________________________________
[hidden email] 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.