[R] using "cochran.test()" as a "mcnemar.test()" ?
David Winsemius
dwinsemius at comcast.net
Tue Jun 2 00:40:17 CEST 2009
On Jun 1, 2009, at 6:01 PM, Tal Galili wrote:
> Hi Chuck,
> Thank you for the fast reply.
> I looked through that thread (that's how I came across the commands I
> wrote).
>
> 1) My question was if this command (cochran.test) could be used the
> same way
> as (mcnemar.test). It obviously can't be, but maybe there is another
> command
> I don't know about.
???. What is wrong with mcnemar.test()?
>
> 2) Why do you think I might not want this test ?
They test different hypotheses. The McNemar test tests for equal
probabilities of cells (i,j) and (j,i), in essence a test of symmetry
across the diagonal, whereas the Cochran test is for the similarity of
distribution in k columns. Who can tell which test you really want?
You have not described your design or research question at all. That
Wikipedia article does not say they are equivalent in general, only
that they are in the 2 x 2 case, which would seem readily apparent.
Thompson's accompaniment to Agresti's text says (p 177):
"Also, McNemar’s test is equivalent to a Cochran-Mantel-Haenszel test
with subjects as strata. Thus, the CMH test is performed on a 2 x 2 x
n table. This table is called the subject-specific table, and will be
used in the next section."
https://home.comcast.net/~lthompson221/Splusdiscrete2.pdf
--
David
>
> Thanks,
> Tal
>
> On Tue, Jun 2, 2009 at 12:56 AM, Chuck Cleland
> <ccleland at optonline.net>wrote:
>
>> On 6/1/2009 5:29 PM, Tal Galili wrote:
>>> Hello all
>>> I wish to perform a mcnemar.test() for a 5X5 matrix.
>>> Wikipedia tells me (http://en.wikipedia.org/wiki/Cochran_test) I
>>> should
>> turn
>>> to cochran.test.
>>> The only place I found it was in the "outliers" package, but the
>>> command
>>> cochran.test() acts differently then mcnemar.test() , and doesn't
>>> take a
>>> table as input.
>>>
>>> Any ideas on how to use it ?
>>>
>>> #Example code:
>>> aa =
>>>
>> as
>> .table(matrix(c(0,0,0,0,1,0,2,2,1,0,1,2,2,1,0,1,1,3,2,0,0,0,1,2,3),
>> 5,5))
>>> mcnemar.test(aa)
>>> # p-value = NA
>>> install.packages("outliers")
>>> require(outliers)
>>> cochran.test(aa)
>>> # Error in x$terms : $ operator is invalid for atomic vectors
>>>
>>> Thanks,
>>> Tal
>>
>> I'm not sure you actually want Cochran's Q Test, but if you do see
>> this thread:
>>
>> https://stat.ethz.ch/pipermail/r-help/2006-September/113139.html
>>
>> --
>> Chuck Cleland, Ph.D.
> ----------------------------------------------
>
>
> My contact information:
> Tal Galili
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list