mantelhaen.test {ctest} | R Documentation |
mantelhaen.test
performs a Mantel-Haenszel chi-square test of
the null that x
and y
are conditionally independent in
each stratum.
mantelhaen.test(x, y = NULL, z = NULL, correct = TRUE)
x |
either an array of dimension 2 by 2 by s, where s is the number of strata, or a dichotomous factor object. |
y |
a dichotomous factor object; ignored if x is an array. |
z |
a factor object idenitifying to which stratum the
corresponding elements in x and y belong; ignored
if x is an array. |
correct |
a logical indicating whether to apply continuity correction when computing the test statistic. |
If x
is an array, it must be of dimension 2 by 2 by s, and
the entries should be nonnegative integers. NA
's are not
allowed. Otherwise, x
, y
and z
must have the
same length. Triples containing NA
's are removed. Both
x
and y
must be dichotomous (take exactly 2 values).
"htest"
containing the following
components:
statistic |
the Mantel-Haenszel chi-square statistic. |
parameter |
always 1, the degrees of freedom of the approximate chi-square distribution of the test statistic. |
p.value |
the p-value of the test. |
method |
a string indicating the method employed, and whether or not continuity correction was used. |
data.name |
a character string giving the names of the data. |