Skip to content
Prev 167141 / 398502 Next

interpolation to abscissa

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) ) ) )