[R] Forcing the extrapolation of loess through the origin

Stavros Macrakis macrakis at alum.mit.edu
Tue Apr 14 20:15:10 CEST 2009


On Tue, Apr 14, 2009 at 1:08 PM,  <jimm-panse at gmx.de> wrote:
> I'm fitting a line to my dataset. Later I want to predict missing values that exceed the [min,max] interval of my empirical data, therefore I choose surface="direct" for extrapolation.
>
> l1<-loess(y1~x1,span=0.1,data.frame(x=x1,y=y1),control=loess.control(surface="direct"))
>
> In my application it is highly important that the fitted line intercepts at the point of origin. Is it possible to do this in R?

Well, you could always add lots of artificial data points x=0, y=0
..., like this:

l1<-loess(y1~x1,span=0.1,data.frame(x=c(rep(0,100),x1),y=c(rep(0,100),y1)),control=loess.control(surface="direct"))

which will eventually drive f(0) to near 0, but surely that will
create fitting artifacts.

          -s




More information about the R-help mailing list