[R] How to calculate Confidence Interval for a prediction using Partial Regression?
I have two highly correlated variables (y and x), and both of them depend on a third variable (A, for Area). Multiple regression (y=a+(b*x)+(c*A)) would have collinearity problems, so I decided to do a partial regression to predict y. I did it this way:
- I regressed y to A, and calculated the residuals (e_y) (reg1)
- I regressed x to A, and calculated the residuals (e_x) (reg2)
- I regressed e_y to e_x (reg5)
It looks like this:
y = a_0 + a_1 A (reg1)
x = b_0 + b_1 A (reg2)
e_y = y - (a_0 + a_1 A) (3)
e_x = x - (b_0 + b_1 A) (4)
e_y = beta_0 + beta_1 e_x (reg5)
Then, to predict a y_0 from a new x_0 and A_0, we would:
Calculate e_x0 with the equation (4). Calculate e_y0 with the equation (reg5) and then:
y_0 = e_y0 + (a_0 + a_1 A_0)
Now, I would like to know how different in Area (A) must be two new observations with the same x_0 value to have different predicted y_0 values. Right now, the only way I can see to find that is to calculate a Confidence Interval for my partial regression-based predictions (the prediction interval), and I don't know how to. Any help will be welcome! Thanks in advance!