[R] Help me in Cochran armitage trend test Coding

Henric Nilsson (Public) nilsson.henric at gmail.com
Thu Nov 1 07:42:26 CET 2007



Shibu John wrote:
> Dear sir,
> 
> I am Shibu John from Thrombosis Research Institute India. It is a
> multidisciplinary organisation concerned with the interrelated problems of
> thrombosis and atherosclerosis.
> 
> I was searching for Cochran armitage trend test program in R. Then I had
> seen your R coding for C-A trend test.  I tried that in the R software.
> But I can’t run the program due the [Error: could not find function
> "independence_test"]. Where is the declaration of this function?

In the `coin' package.

> 
> I was trying the trend test for Genotype frequency in Cases and controls.
> So I would like to know how to do the Monte carlo simulation test with
> Cochran armitage trend test.
> 
> Sir can you please help me to solve the problem.
> 
> 
> 
> Here I copied the codes from R
> 
>> library("coin")
> Loading required package: survival
> Loading required package: splines
> Loading required package: mvtnorm
> Error: package 'modeltools' required by 'coin' could not be found

So, you need to install package `modeltools'...

> In addition: Warning messages:
> 1: package 'coin' was built under R version 2.6.0
> 2: package 'survival' was built under R version 2.5.1
> 3: package 'mvtnorm' was built under R version 2.5.1

Since you've failed to provide the result of `sessionInfo()', we don't 
know which version of R and the packages you've installed or your platform.

In any case, packages should be built using the R version you intend to 
use them under. Here, judging from the above warnings, you have package 
built under a mix of R 2.6.0 and 2.5.1. And since it complains about 
both, I guess your running neither.

So, (re-)install R 2.6.0, the `coin' package and all its dependencies 
and everything is more likely to work. (As it does for me.)


HTH,
Henric



>> 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)
> 
>      0  1
>   0 38  2
>   1 43  7
>   2 33 15
>> independence_test(tumor ~ dose, data = lungtumor, teststat = "quad")
> Error: could not find function "independence_test"
> 
> 
> 
> sincerely,
> 
> Shibu John
> Research Assistant
> Department of Bioinformatics
> Thrombosis Research Institute
> Narayana Hrudayalaya
> 258/A Bommasandra Industrial Area, Anekal Taluk
> Bangalore 560099, India
> 
> ______________________________________________
> 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.
>



More information about the R-help mailing list