[R-sig-teaching] Comparing Points on Two Regression Lines
Ole J. Forsberg, Ph.D.
oforsber at kvasaheim.com
Sun Apr 1 07:20:18 CEST 2012
Thread,
When discussing statistical tests with my students, I emphasize clarity.
I have noticed that once they clearly define what they mean by
"compare," the method becomes obvious to them.
In this question, it is very easy to compare 84.42477 and 76.86037 --
the first is larger than the second -- however, this is really not the
question being asked. What is the question being asked? Is the first
(statistically) significantly larger than the second? Well, what is the
standard error at those points? Is the first (practically) significantly
larger than the second? That depends on the goals of the research. Both
questions are important. Neither question can be answered by the
question posed.
~ Ole
On 3/31/2012 9:01 PM, AbouEl-Makarim Aboueissa wrote:
> What I need is to compare these predicted values on both lines:
>
>> predict(m1, newdata = data.frame(x = x))
> 1 2 3 4 5
> 84.42477 84.26280 81.34729 60.29085 27.89632
>
>
>> predict(m2, newdata = data.frame(x = x))
> 1 2 3 4 5
> 76.86037 76.69170 73.65554 51.72772 17.99261
>
> for example: compare 84.42477 versus 76.86037 , and 84.26280 versus 76.69170 and so on.
>
>
>
>
> with many thanks
> abou
>
>
>
>
> ==========================
> AbouEl-Makarim Aboueissa, Ph.D.
> Associate Professor of Statistics
> Graduate Program Coordinator
> Department of Mathematics& Statistics
> University of Southern Maine
> 96 Falmouth Street
> P.O. Box 9300
> Portland, ME 04104-9300
> USA
>
>
> Tel: (207) 228-8389
> Fax: (207) 780-5607
> Email: aaboueissa at usm.maine.edu
> aboueiss at yahoo.com
>
> Office: 301C Payson Smith
>
>>>> "R. Michael Weylandt"<michael.weylandt at gmail.com> 3/31/2012 9:13 PM>>>
> Again, you need to clarify what you mean by compare, but here's a
> better way to do predict from a linear model -- my first guess was
> simple interpolation (not very good):
>
> m1<- lm(y ~ x, data = data.frame(y = y1, x = x1))
> m2<- lm(y ~ x, data = data.frame(y = y2, x = x2))
>
> predict(m1, newdata = data.frame(x = x))
> predict(m2, newdata = data.frame(x = x))
>
> Perhaps you want an ANOVA (?anova) test to compare the models: if you
> want to compare the predicted values at x directly, you could use
> interval="predict" for the different models and see if they overlap at
> a given confidence level.
>
> Michael
>
> PS -- Please do cc the list: I'm not a statistics expert by any means
> and I'd hate for what I say to go unreviewed by actual experts.
>
> On Sat, Mar 31, 2012 at 8:19 PM, AbouEl-Makarim Aboueissa
> <aaboueissa at usm.maine.edu> wrote:
>> I need to compare the value of y1-hat versus y2-hat corresponding to these
>> values of x<-c(0.10,0.20,2.0,15.0,35.0)
>> e.g. for x=0.10 compare y1-hat(x=0.10) versus y2-hat(x=0.10) and so on.
>>
>> thanks
>> abou
>>
>>
>>>>> "R. Michael Weylandt"<michael.weylandt at gmail.com> 3/31/2012 8:10 PM>>>
>> ? approxfun
>>
>> f1<- approxfun(x1,y1)
>> f2<- approxfun(x2,y2)
>>
>> f1(x) - f2(x)
>>
>> But I'm not sure what you mean be compare...do you have a particular
>> test in mind?
>>
>> Michael
>>
>> On Sat, Mar 31, 2012 at 8:04 PM, AbouEl-Makarim Aboueissa
>> <aaboueissa at usm.maine.edu> wrote:
>>> Dear All:
>>>
>>> I am trying to compare points on two regression lines given some specific
>>> values of X. I am not sure how to do it in R and/or in SAS. Can someone help
>>> me, and show me how to conduct such test in R.
>>>
>>>
>>> You can use the following data for both lines.
>>>
>>> ### data for line 1:
>>> ### =========
>>>
>>> x1<-c(0.0,0.25,2.5,25.0,50.0)
>>> y1<-c(100.0,79.0,74.0,36.0,8.0)
>>>
>>>
>>>
>>> ### data for line 2:
>>> ### =========
>>>
>>> x2<-c(0.0,0.25,2.5,25.0,50.0)
>>> y2<-c(100.0,79.0,55.0,18.0,2.0)
>>>
>>>
>>> ### these are the given values of X:
>>> ### ===================
>>>
>>> x<-c(0.10,0.20,2.0,15.0,35.0)
>>>
>>>
>>> thank you very much in advance
>>> abou
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ==========================
>>> AbouEl-Makarim Aboueissa, Ph.D.
>>> Associate Professor of Statistics
>>> Graduate Program Coordinator
>>> Department of Mathematics& Statistics
>>> University of Southern Maine
>>> 96 Falmouth Street
>>> P.O. Box 9300
>>> Portland, ME 04104-9300
>>> USA
>>>
>>>
>>> Tel: (207) 228-8389
>>> Fax: (207) 780-5607
>>> Email: aaboueissa at usm.maine.edu
>>> aboueiss at yahoo.com
>>>
>>> Office: 301C Payson Smith
>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-teaching at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-teaching at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
>
More information about the R-sig-teaching
mailing list