Re: [R] predict function the other way around

2009-05-11 Thread David Winsemius
Why not use the x=T and y=T paramemters and see if : linearmodel=lm(y~x, x=T, y=T)linearmodel$model (linearmodel$model) y x 1 2 1 2 4 2 3 6 3 4 8 4 5 10 5 give you useful results. If you want to interpolate or extrapolate, then search for threads regarding those tasks. -- David W

[R] predict function the other way around

2009-05-11 Thread Gerrit Voigt
Dear List, Consider the following example x=c(1,2,3,4,5) y=c(2,4,6,8,10) linearmodel=lm(y~x) To predict a y-value if you know the corresponding x value is very easy with the command predict. predict(linearmodel, newdata=(x=1.5)) The other way around, to predict an x-value with a correspondin