[R] Cochrans Q Test

From: <peter.gremse_at_numbers.net.au>
Date: Mon 18 Sep 2006 - 04:01:03 GMT


I would like to conduct a Cochran`s Q Test in R, but have not found any suitable function.

My first idea was: J <- as.table(matrix(c(6,16,2,4),ncol=2, dimnames = list("C" = c("Favorable","Unfavorable"),"Drug A Favorable"=c("B Favorable","B Unfavorable"))))
L <- as.table(matrix(c(2,4,6,6),ncol=2, dimnames = list("C" = c("Favorable","Unfavorable"),"Drug A Unfavorable"=c("B Favorable","B Unfavorable"))))
mantelhaen.test(J,L, alternative="t")

But this is obviously the wrong function.

Then I googled and found (different data):

K <- as.table(matrix(c(1,1,0,0, 1,1,0,1, 1,1,1,1, 1,1,1,1, 1,0,0,0, 
1,1,1,1, 1,1,1,1, 0,0,0,0, 0,1,0,1, 1,1,1,1, 0,1,0,1, 0,1,0,1),ncol=12, 
dimnames = list("Seating type" = c("I","II","III","IV"),"Test 
subject"=c("A","B","C","D","E","F","G","H","I","J","K","L")))) K

But R said that this function does not exist. Can anyone help?

R-help@stat.math.ethz.ch 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. Received on Mon Sep 18 17:04:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 18 Sep 2006 - 13:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.