[R] using "cochran.test()" as a "mcnemar.test()" ?

Chuck Cleland ccleland at optonline.net
Tue Jun 2 00:53:58 CEST 2009


On 6/1/2009 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.
> 2) Why do you think I might not want this test ?

  You posted a 5x5 matrix with values ranging from 0-3.  That does not
fit with assumptions 1 and 3 described on the Wikipedia page you posted
(a large number of blocks and outcomes of the treatments coded as binary
responses).

hope this helps,

Chuck

> Thanks,
> Tal
> 
> 
> 
> 
> On Tue, Jun 2, 2009 at 12:56 AM, Chuck Cleland <ccleland at optonline.net
> <mailto: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.
>     NDRI, Inc. (www.ndri.org <http://www.ndri.org>)
>     71 West 23rd Street, 8th floor
>     New York, NY 10010
>     tel: (212) 845-4495 (Tu, Th)
>     tel: (732) 512-0171 (M, W, F)
>     fax: (917) 438-0894
> 
> 
> 
> 
> -- 
> ----------------------------------------------
> 
> 
> My contact information:
> Tal Galili
> Phone number: 972-50-3373767
> FaceBook: Tal Galili
> My Blogs:
> http://www.r-statistics.com/
> http://www.talgalili.com
> http://www.biostatistics.co.il 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list