Biostar Beta. Not for public use.
Cochran-Armitage test in R
2
Entering edit mode
15 months ago

Hi.

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

Thanks.

ADD COMMENTlink
2
Entering edit mode
10 months ago
London

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 COMMENTlink
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 REPLYlink
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 REPLYlink
0
Entering edit mode

[here] link is broken.

ADD REPLYlink
1
Entering edit mode
2.0 years ago
dk364 • 10

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

ADD COMMENTlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1