MHChisqTest.Rd
The Mantel-Haenszel chi-square statistic tests the alternative hypothesis that there is a linear association between the row variable and the column variable. Both variables must lie on an ordinal scale.
The statistic is computed as \( Q_{MH} = (n-1) \cdot r^2\), where \(r^2\) is the Pearson correlation between the row variable and the column variable. The Mantel-Haenszel chi-square statistic use the scores specified by srow and scol. Under the null hypothesis of no association, \(Q_{MH}\) has an asymptotic chi-square distribution with one degree of freedom.
A list with class "htest"
containing the following
components:
the value the Mantel-Haenszel chi-squared test statistic.
the degrees of freedom of the approximate chi-squared distribution of the test statistic.
the p-value for the test.
a character string indicating the type of test performed.
a character string giving the name(s) of the data.
Agresti, A. (2002) Categorical Data Analysis. John Wiley & Sons, pp 86 ff.
chisq.test
,
for calculating correlation of a table: corr
## A r x c table Agresti (2002, p. 57) Job Satisfaction
Job <- matrix(c(1,2,1,0, 3,3,6,1, 10,10,14,9, 6,7,12,11), 4, 4,
dimnames = list(income = c("< 15k", "15-25k", "25-40k", "> 40k"),
satisfaction = c("VeryD", "LittleD", "ModerateS", "VeryS"))
)
MHChisqTest(Job, srow=c(7.5,20,32.5,60))
#>
#> Mantel-Haenszel Chi-Square
#>
#> data: Job
#> X-squared = 3.8075, df = 1, p-value = 0.05102
#>