# Chi-Squared test
tbl <- matrix(
c(13, 7, 8, 12),
nrow = 2,
byrow = TRUE,
dimnames = list(group = c("A", "B"), response = c("TRUE", "FALSE"))
)
prop_chisq(tbl)
# Cochran-Mantel-Haenszel test with two strata
ary <- array(
c(12, 8, 8, 12, 10, 10, 6, 14),
dim = c(2, 2, 2),
dimnames = list(
group = c("A", "B"),
response = c("TRUE", "FALSE"),
strata = c("Low", "High")
)
)
prop_cmh(ary)
# Chi-Squared test with Schouten correction
tbl <- matrix(
c(13, 7, 8, 12),
nrow = 2,
byrow = TRUE,
dimnames = list(group = c("A", "B"), response = c("TRUE", "FALSE"))
)
prop_schouten(tbl)
# Fisher's exact test
tbl <- matrix(
c(13, 7, 8, 12),
nrow = 2,
byrow = TRUE,
dimnames = list(group = c("A", "B"), response = c("TRUE", "FALSE"))
)
prop_fisher(tbl)
Run the code above in your browser using DataLab