[R] equation of confidence interval calculated by predict.lm

kloe chloe.bonnineau at udg.edu
Fri Jan 9 19:38:00 CET 2009


Hello,
Sorry to ask this question, I have been searching quite a lot but I could
not find an answer.
I have seen one post about this subject but I did not really understand the
answer.

I have a linear regression with 95% confidence interval.
I would like to find the x-absciss of the intersection point with the upper
confidence interval curve and a straight line (y=y0).
For this I apply a formula of inverse regression from Draper and Smith,
(Applied Regression analysis,1981): 
Xu=mean(X)+(b1(Yo-mean(Y))+t*s*(((Yo-mean(Y))²/Sxx)+(b1²/n)-(t²*s²/n*Sxx))^(1/2))/(b1²-t²*s²/Sxx)
with:
n=number of points in the regression
Yo:ordinate of the intersection point
b1:slope of linear regression
s:sample standard deviation
Sxx=sum(Xi-mean(X))²
t=t(v,1-a/2) with a=0.05 and v=number of degrees of freedom of s²

To check my code, I plot the regression line with its confidence interval
(using predict.lm) and y=Yo, and it was clear that results were not as
expected. It seems that the formula for confidence interval used by Draper
and Smith, is the following: Y=bo+b1*X +/-
t*s*((1/n)+(X-mean(X))²/Sxx)^(1/2))
with the same parameters as above and bo being the second parameter from
regression.

I also plotted this equation and I did not obtain the same confidence
interval as the one predicted by predict.lm....
I would like to know which formula is used in predict.lm to calculate
correctly the confidence interval in order to calculate correctly the
intersection point... I try to read the code but I did not get a clue...

Any help would be really welcome, thanks a lot for your time !!
Have a good day!!
Chloé

-- 
View this message in context: http://www.nabble.com/equation-of-confidence-interval-calculated-by-predict.lm-tp21377924p21377924.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list