# heterogeneity.test: Heterogeneity Test for Difference Across Contingency Tables In DiffXTables: Pattern Analysis 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

 `1` ``` 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.

The comparative chi-squared test `cp.chisq.test`.

The Sharma-Song test `sharma.song.test`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ``` # 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) ```

### Example output

```sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied

Heterogeneity Test for Pattern Difference

data:  tables
X-squared = 36, df = 4, p-value = 2.894e-07

Heterogeneity Test for Pattern Difference

data:  tables
X-squared = 13.977, df = 12, p-value = 0.3022
```

DiffXTables documentation built on May 16, 2021, 9:07 a.m.