[R] Cochrans Q Test

peter.gremse at numbers.net.au peter.gremse at numbers.net.au
Mon Sep 18 06:01:03 CEST 2006


Hi!

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
pcochran(K,4,12)

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



More information about the R-help mailing list