[R] How do I test against a simple null that tworegressions coefficients are equal?

chen jia chen_1002 at fisher.osu.edu
Thu Jul 8 17:24:48 CEST 2010


Bert,

Thanks for replying. Actually, Chuck and Mark's suggestions already
helped, especially regarding to the problem you call type III error.

Best,
Jia

On Thu, Jul 8, 2010 at 11:06 AM, Bert Gunter <gunter.berton at gene.com> wrote:
> Inline below.
>
> Bert Gunter
> Genentech Nonclinical Statistics
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf Of markleeds at verizon.net
>> Sent: Thursday, July 08, 2010 7:52 AM
>> To: chen_1002 at fisher.osu.edu
>> Cc: r-help at r-project.org; cberry at tajo.ucsd.edu
>> Subject: Re: [R] How do I test against a simple null that tworegressions
>> coefficients are equal?
>>
>>
>>    hi: no. it's not the same. if you read the paper that I referenced last
>>    night, that explains how to do the following  test :
>>    Ho: R2 = R1
>>    H1: R2 != R1
>>    that's a different test from what you did but i think it's what you
>> want.
>>
>>    On Jul 8, 2010, chen jia <chen_1002 at fisher.osu.edu> wrote:
>>
>>      Thanks, Chuck. I am reading the references, which are helpful.
>>      Just to understand what I have done wrong here,
>>      I proposed an alternative testing strategy:
>>      I run regressions y = a3 + b1 * x + b2 * z + e3 and test alternative
>>      hypothesis b1 != b2 against the null hypothesis b1 = b2 in this
>>      equation.
>
> If this is what you want (see below) try this:
>
> w <- x + z
>
> anova(lm(y ~ w), lm(y ~ x + w))
>
>
> However, as you seem to be somewhat at sea in your basic statistical
> knowledge, I suggest you consult a local statistician to make sure whether
> you are asking sensible questions in the first place. You appear to be at
> high risk for type III error (right answer to wrong question).
>
> -- Bert
>
>
>
>
>>      Is it this the same test as
>>      y = a1 + b1*x + e1
>>      y = a2 + b2*x + e2
>>      test alternative hypothesis b1 != b2 against null hypothesis b1 = b2.
>>      Best,
>>      Jia
>>      On Wed, Jul 7, 2010 at 11:12 PM, Charles C. Berry
>> <cberry at tajo.ucsd.edu>
>>      wrote:
>>      > On Wed, 7 Jul 2010, chen jia wrote:
>>      >
>>      >> Hi there,
>>      >>
>>      >> I run two regressions:
>>      >>
>>      >> y = a1 + b1 * x + e1
>>      >> y = a2 + b2 * z + e2
>>      >>
>>      >> I want to test against the null hypothesis: b1 = b2. Â How do I
>> design
>>      the
>>      >> test?
>>      >>
>>      >
>>      >  You  are testing a non-nested hypothesis, which requires special
>>      handling.
>>      >
>>      > The classical test is due to Hotelling, but see the references (and
>> R
>>      code
>>      > snippets) in this posting:
>>      >
>>      > Â  Â  Â  Â http://markmail.org/message/egnowmdzpzjtahy7
>>      >
>>      > (it is the merest coincidence that the above thread was initiated
>> by
>>      Mark
>>      > Leeds and that the URL is 'markmail' :-) )
>>      >
>>      > HTH,
>>      >
>>      > Chuck
>>      >
>>      >
>>      >> I think I can add two equations together and divide both sides by
>> 2:
>>      >> y = 0.5*(a1+a2) + 0.5*b1 * x + 0.5*b2 * z + e3, where e3 = 0.5*(e1
>> +
>>      e2).
>>      >> or just y = a3 + 0.5*b1 * x + 0.5*b2 * z + e3
>>      >>
>>      >> If I run this new regression, I can test against the null b1 = b2
>> in
>>      >> this regression. Â Is it an equivalent test as the original one?
>> If
>>      >> yes, how do I do that in R?
>>      >>
>>      >> Alternatively, I think I can just test against the null:
>>      >> correlation(y, x) = correlation(y, z), where correlation(. , .) is
>> the
>>      >> correlation between two random variables. Is this equivalent too?
>> If
>>      >> yes, how do I do it in R?
>>      >>
>>      >> Thanks.
>>      >>
>>      >> Best,
>>      >> Jia
>>      >>
>>      >> --
>>      >> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â Ohio State University - Finance
>>      >> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â 248 Fisher Hall
>>      >> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  2100 Neil Ave.
>>      >>   Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Columbus, Ohio  43210
>>      >> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â Telephone: 614-292-2830
>>      >> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â
>> http://www.fisher.osu.edu/~chen_1002/
>>      >>
>>      >> ______________________________________________
>>      >> R-help at r-project.org mailing list
>>      >> https://stat.ethz.ch/mailman/listinfo/r-help
>>      >> PLEASE do read the posting guide
>>      >> http://www.R-project.org/posting-guide.html
>>      >> and provide commented, minimal, self-contained, reproducible code.
>>      >>
>>      >
>>      > Charles C. Berry   Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â (858)
>> 534-2098
>>      > Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â
>> Dept of
>>      Family/Preventive
>>      > Medicine
>>      > E mailto:cberry at tajo.ucsd.edu   Â  Â  Â  Â  Â  Â  UC San Diego
>>      >  http://famprevmed.ucsd.edu/faculty/cberry/ Â La Jolla, San Diego
>>      92093-0901
>>      >
>>      >
>>      >
>>      --
>>      Ohio State University - Finance
>>      248 Fisher Hall
>>      2100 Neil Ave.
>>      Columbus, Ohio 43210
>>      Telephone: 614-292-2830
>>      http://www.fisher.osu.edu/~chen_1002/
>>      ______________________________________________
>>      R-help at r-project.org mailing list
>>      https://stat.ethz.ch/mailman/listinfo/r-help
>>      PLEASE do read the posting guide
>>      http://www.R-project.org/posting-guide.html
>>      and provide commented, minimal, self-contained, reproducible code.
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
                         Ohio State University - Finance
                                   248 Fisher Hall
                                    2100 Neil Ave.
                              Columbus, Ohio  43210
                             Telephone: 614-292-2830
                       http://www.fisher.osu.edu/~chen_1002/



More information about the R-help mailing list