[R] Comparing Points on Two Regression Lines
John Fox
jfox at mcmaster.ca
Tue Mar 31 00:38:43 CEST 2009
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
> -----Original Message-----
> From: AbouEl-Makarim Aboueissa [mailto:aaboueissa at usm.maine.edu]
> Sent: March-30-09 4:57 PM
> To: jfox at mcmaster.ca; jrkrideau at yahoo.ca; pburns at pburns.seanet.com; r-
> help at stat.math.ethz.ch; r-help-request at stat.math.ethz.ch;
> roland.rproject at gmail.com; tuechler at gmx.at; wwwhsd at gmail.com
> Subject: Comparing Points on Two Regression Lines
>
> Dear R users:
>
>
>
> Suppose I have two different response variables y1, y2 that I regress
> separately on the different explanatory variables, x1 and x2 respectively. I
> need to compare points on two regression lines.
>
>
>
> These are the x and y values for each lines.
>
>
>
> x1<-c(0.5,1.0,2.5,5.0,10.0)
> y1<-c(204,407,1195,27404313)
> x2<-c(2.5,5.0,10.0,25.0)
> y2<-c(440,713,1520,2634)
>
>
>
> Suppose we need to compare the two lines at the common value of x=13.
>
>
>
> Please see attached the method as described in section 18.3 in Jerrold H.
> Zar.
>
>
>
> With many thanks
>
>
>
> Abou
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ==========================
> AbouEl-Makarim Aboueissa, Ph.D.
> Assistant Professor of Statistics
> Department of Mathematics & Statistics
> University of Southern Maine
> 96 Falmouth Street
> P.O. Box 9300
> Portland, ME 04104-9300
>
>
> Tel: (207) 228-8389
> Fax: (207) 780-5607
> Email: aaboueissa at usm.maine.edu
> aboueiss at yahoo.com
>
> http://www.usm.maine.edu/~aaboueissa/
>
>
> Office: 301C Payson Smith
>
More information about the R-help
mailing list