Learn R Programming

DescTools (version 0.99.19)

StuartMaxwellTest: 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.

Value

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

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.

References

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

See Also

mcnemar.test, chisq.test, MHChisqTest, BreslowDayTest

Examples

Run this code
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)

Run the code above in your browser using DataLab