On Tue, 14 Apr 2009, jimm-pa...@gmx.de wrote:

Hi all,

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, yes, but as Burt suggests it may not be sensible.

There are several ways. For one, include a reflection of the (x,y) data into opposite quandrants as well as the original data.

Something like

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

will force the prediction through the origin.

(I corrected what seems to be as typo in your code, too.)

Of course, if any( x < 0 ) it is hard to see how the substantive results would make any sense.

HTH,

Chuck


Thanks in advance.

Cheers,
Torsten
--

______________________________________________
R-help@r-project.org 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.


Charles C. Berry                            (858) 534-2098
                                            Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu               UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
R-help@r-project.org 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 via email to