Skip to content
Prev 175498 / 398506 Next

Comparing Points on Two Regression Lines

Dear Abu,

I'm not sure why you're addressing this question to me.

It's unclear from your description whether there is one sample with four variables or two independent samples with the same two variables x and y. I'll assume the latter. The formula that you sent appears to assume equal error variances in two independent samples. A simple alternative that doesn't assume equal error variances would be to use something like

mod1 <- lm(y1 ~ x1)
mod2 <- lm(y2 ~ x2)

f1 <- predict(mod1, newdata=data.frame(x1=13), se.fit=TRUE)
f2 <- predict(mod2, newdata=data.frame(x2=13), se.fit=TRUE)

diff <- f1$fit - f2$fit
sediff <- sqrt(f1$se.fit^2 + f2$se.fit^2)
diff/sediff

The df for the test statistic aren't clear to me and in small samples this could make a difference. I suppose that one could use a Satterthwaite approximation, but a simple alternative would be to take the smaller of the residual df, here 5 - 2 = 3. In any event, the resulting test is likely sensitive to departures from normality, so it would probably be better to use a randomization test.
 
John