Title: | The Cochran-Armitage Trend Test |
---|---|
Description: | This function conducts the Cochran-Armitage trend test to a 2 by k contingency table. It will report the test statistic (Z) and p-value.A linear trend in the frequencies will be calculated, because the weights (0,1,2) will be used by default. |
Authors: | Zhicheng Du, Yuantao Hao |
Maintainer: | Zhicheng Du<[email protected]> |
License: | GPL-3 |
Version: | 2.0 |
Built: | 2025-03-01 06:06:54 UTC |
Source: | https://github.com/cran/CATT |
This function conducts the Cochran-Armitage trend test to a 2 by k contingency table. It will report the test statistic (Z) and p-value. A linear trend in the frequencies will be calculated, because the weights (0,1,2) will be used by default.
CATT(binomial,ordinal,table)
CATT(binomial,ordinal,table)
ordinal |
the vector of the ordinal variable |
binomial |
the vector of the binomial variable |
table |
option, the contingency table of table(binomial,ordinal) |
Z |
the test statistic |
p.value |
the p value of the hypothesis test |
Please feel free to contact us, if you have any advice and find any bug!
Reference:
1. Cochran, WG (1954). Some methods for strengthening the common chi-squared tests. Biometrics. International Biometric Society. 10 (4): 417-451.
2. Armitage, P (1955). Tests for Linear Trends in Proportions and Frequencies. Biometrics. International Biometric Society. 11 (3): 375-386.
Update:
Version 0.2.0: The p value of two side was specified.
Zhicheng Du<[email protected]>, Yuantao Hao<[email protected]>
# type of data is variable binomial=c(rep(0,20),rep(1,10),rep(0,20),rep(1,20),rep(0,20),rep(1,30)) ordinal=c(rep(0,30),rep(1,40),rep(2,50)) CATT(binomial=binomial,ordinal=ordinal) # type of data is table tbl=matrix(c(20,10,20,20,20,30),nrow=2) CATT(table=tbl)
# type of data is variable binomial=c(rep(0,20),rep(1,10),rep(0,20),rep(1,20),rep(0,20),rep(1,30)) ordinal=c(rep(0,30),rep(1,40),rep(2,50)) CATT(binomial=binomial,ordinal=ordinal) # type of data is table tbl=matrix(c(20,10,20,20,20,30),nrow=2) CATT(table=tbl)