
Last chance! 50% off unlimited learning
Sale ends in
This function computes the marginal homogeneity test for a
StuartMaxwellTest(x, y = NULL)
either a 2-way contingency table in matrix form, or a factor object.
a factor object; ignored if x is a matrix.
A list with class "htest"
containing the following components:
the value of the test statistic.
the degrees of freedom.
the p-value of the test.
a character string indicating what type of test was performed.
a character string giving the name of the data.
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.
Agresti, A. (2002) Categorical Data Analysis. John Wiley & Sons, pp 86 ff.
# NOT RUN {
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