[R] interpolation to abscissa

David Winsemius dwinsemius at comcast.net
Thu Jan 15 18:19:16 CET 2009


It appears the answer to your goal after a discursive exploration of  
"interpolation", which was really extrapolation, is that you need to  
look at the predict methods for linear (and other sorts as well) models.

?predict
?predict.lm

 > y <- c(16,45,77,101,125)
 > x <- c(0,5,10,15,20)
 >
 > lmmod <- lm(y ~ x)

 > plot(x,y,  ylim = c(0,125), xlim =c(-4,22))  #defaults would not  
allow estimates from plot

 > lines(x=seq(-4,22, by=.5),
         y=predict(lm(y ~ x), newdata = data.frame(x = seq(-4,22, by=. 
5) ) ) )


-- 
David Winsemius


On Jan 15, 2009, at 11:31 AM, e-letter wrote:

>
snipped preceding excursion




More information about the R-help mailing list