[R] Cochran-Armitage

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Fri Dec 12 14:57:16 CET 2008


Chuck Cleland wrote:
> On 12/12/2008 3:29 AM, robert-mcfadden at o2.pl wrote:
>> Hello,
>> Which package allows to use Cochrana-Armitage trend test? I tried to search for but I found only package coin in which there is no explicit function.
> 
>   But there is this example in coin:
> 
> ### Cochran-Armitage trend test for proportions
> ### Lung tumors in female mice exposed to 1,2-dichloroethane
> ### Encyclopedia of Biostatistics (Armitage & Colton, 1998),
> ### Chapter Trend Test for Counts and Proportions, page 4578, Table 2
> lungtumor <- data.frame(dose = rep(c(0, 1, 2), c(40, 50, 48)),
>                         tumor = c(rep(c(0, 1), c(38, 2)),
>                                   rep(c(0, 1), c(43, 7)),
>                                   rep(c(0, 1), c(33, 15))))
> table(lungtumor$dose, lungtumor$tumor)
> 
> ### Cochran-Armitage test (permutation equivalent to correlation
> ### between dose and tumor), cf. Table 2 for results
> independence_test(tumor ~ dose, data = lungtumor, teststat = "quad")
> 
>   See the following:
> 
> http://finzi.psych.upenn.edu/R/library/coin/html/ContingencyTests.html


Also prop.trend.test().

There seems to be a subtle difference, though:

> independence_test(tumor ~ dose, data = lungtumor, teststat = "quad")

        Asymptotic General Independence Test

data:  tumor by dose
chi-squared = 10.6381, df = 1, p-value = 0.001108


> tt <- table(lungtumor$dose, lungtumor$tumor)
> prop.trend.test(tt[,2],rowSums(tt))

        Chi-squared Test for Trend in Proportions

data:  tt[, 2] out of rowSums(tt) ,
 using scores: 1 2 3
X-squared = 10.7157, df = 1, p-value = 0.001062


Anyone have a guess at what the difference is? (Just curious.)

	-pd


> 
>   There also is an implementation in the GeneticsBase package
> (Bioconductor).
> 
>> Best,
>> RobMac 
>>
>> ______________________________________________
>> 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. 
> 


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list