# NOT RUN {
## Example data
dta <- data.frame(
y = gl(3, 2),
x = sample(gl(3, 2))
)
## Asymptotic Cochran-Mantel-Haenszel Test
ct <- cmh_test(y ~ x, data = dta)
## The linear statistic, i.e., the contingency table...
(l <- statistic(ct, type = "linear"))
## ...and its expectation...
(El <- expectation(ct))
## ...and covariance
(Vl <- covariance(ct))
## The standardized contingency table...
(l - El) / sqrt(variance(ct))
## ...is identical to the standardized linear statistic
statistic(ct, type = "standardized")
# }
Run the code above in your browser using DataCamp Workspace