Cochran-Armitage test in R
2
2
Entering edit mode
7.2 years ago

Hi.

Is there a function in R to implement Cochran-Armitage test? I need to perform this test on allele frequencies.

Thanks.

R snp statistics • 7.8k views
ADD COMMENT
2
Entering edit mode
7.2 years ago

See the thread here

You'll need the Coin package.

library("coin")
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))))
### linear-by-linear association test with scores 0, 1, 2
### is identical with Cochran-Armitage test
lungtumor$dose <- ordered(lungtumor$dose)
independence_test(tumor ~ dose, data = lungtumor, teststat = "quad",
                   scores = list(dose = c(0, 1, 2)))

        Asymptotic General Independence Test

data:  tumor by groups 0 < 1 < 2
T = 10.6381, df = 1, p-value = 0.001108

I've not tested this code, it's skimmed from the link.

ADD COMMENT
1
Entering edit mode

Thanks. There is something which is not clear to me, however: what is the meaning of c(40, 50, 48) in dose = rep(c(0, 1, 2), c(40, 50, 48) ?

ADD REPLY
1
Entering edit mode

That's an example data frame to run the function. c(40, 50, 48) Are the number of repetitions of c(0, 1, 2), as it's wrapped in rep.

ADD REPLY
0
Entering edit mode

[here] link is broken.

ADD REPLY
1
Entering edit mode
5.8 years ago
dk364 ▴ 10

prop.trend.test() function does the same job.

ADD COMMENT

Login before adding your answer.

Traffic: 2566 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6