R: Stuart-Maxwell Marginal Homogeneity Test

StuartMaxwellTest {DescTools} | R Documentation

## Stuart-Maxwell Marginal Homogeneity Test

### Description

This function computes the marginal homogeneity test for a k x k matrix of assignments of objects to k categories or an n x 2 matrix of category scores for n data objects by two raters. The statistic is distributed as chi-square with k-1 degrees of freedom.
It can be viewed as an extention of McNemar test to k x k table.

### Usage

    StuartMaxwellTest(x, y = NULL)

### Arguments

`x` | either a 2-way contingency table in matrix form, or a factor object.
`y` | a factor object; ignored if x is a matrix.

### Details

The null is that the probabilities of being classified into cells [i,j] and [j,i] are the same.

If x is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should be nonnegative integers. Otherwise, both x and y must be vectors or factors of the same length. Incomplete cases are removed, vectors are coerced into factors, and the contingency table is computed from these.

### Value

A list with class `"htest"` containing the following components:

`statistic` | the value of the test statistic.
`parameter` | the degrees of freedom.
`p.value` | the p-value of the test.
`method` | a character string indicating what type of test was performed.
`data.name` | a character string giving the name of the data.

### Author(s)

Andri Signorell <andri@signorell.net>, based on Code from Jim Lemon

### References

Agresti, A. (2002) Categorical Data Analysis. John Wiley & Sons, pp 86 ff.

### See Also

`mcnemar.test`, `chisq.test`, `MHChisqTest`, `BreslowDayTest`

### Examples

    hyp <- as.table(matrix(c(20,3,0,10,30,5,5,15,40), nrow=3))
    StuartMaxwellTest(hyp)

    # Source: http://www.john-uebersax.com/stat/mcnemar.htm#stuart
    mc <- as.table(matrix(c(
             732, 1524, 1575, 1577, 1602, 837, 1554, 1437,
             1672, 1600, 841, 1363, 1385, 1484, 1524, 791), nrow=4))

    StuartMaxwellTest(mc)

[Package DescTools version 0.99.28 Index]