heterogeneity.test {DiffXTables} | R Documentation |
Heterogeneity Test for Difference Across Contingency Tables
Description
Across given contingency tables, the test admits any type of differences in either the joint or marginal distributions of the tables.
Usage
heterogeneity.test(tables)
Arguments
tables |
a list of at least two non-negative matrices or data frames representing contingency tables of the same dimensions. |
Details
The heterogeneity test determines whether the patterns underlying multiple contingency tables are heterogeneous or differential. The chi-squared distribution is used for the null distribution of its test statistic (Zar, 2010).
Value
A list with class "htest
" containing the following components:
statistic |
heterogeneity test statistic. |
parameter |
degrees of freedom of used for the null distribution of the heterogeneity test statistic. |
p.value |
p-value of the heterogeneity test, computed using the chi-squared distribution. |
References
Zar, J. H. (2010) Biostatistical Analysis, 5th Ed., New Jersey: Prentice Hall.
See Also
The comparative chi-squared test cp.chisq.test
.
The Sharma-Song test sharma.song.test
.
Examples
# Two second-order differential tables:
tables <- list(
matrix(c(4,0,0,
0,4,0,
0,0,4), nrow=3),
matrix(c(0,4,4,
4,0,4,
4,4,0), nrow=3)
)
heterogeneity.test(tables)
# Three tables differ in the first-order but not second-order:
tables <- list(
matrix(c(2, 4, 6, 8,
3, 6, 9, 12,
4, 8, 12, 16), nrow=4),
matrix(c( 2, 1, 3, 7,
2, 1, 3, 7,
10, 5, 15, 35), nrow=4),
matrix(c(40, 16, 72, 16,
45, 18, 81, 18,
25, 10, 45, 10), nrow=4)
)
heterogeneity.test(tables)