# NOT RUN {
# for reproducibility
set.seed(123)
library(statsExpressions)
options(tibble.width = Inf, pillar.bold = TRUE, pillar.neg = TRUE)
# ------------------------ non-Bayesian -----------------------------
# association test
contingency_table(
data = mtcars,
x = am,
y = cyl,
paired = FALSE
)
# goodness-of-fit test
contingency_table(
data = as.data.frame(HairEyeColor),
x = Eye,
counts = Freq,
ratio = c(0.2, 0.2, 0.3, 0.3)
)
# ------------------------ Bayesian -----------------------------
# association test
contingency_table(
data = mtcars,
x = am,
y = cyl,
paired = FALSE,
type = "bayes"
)
# goodness-of-fit test
contingency_table(
data = as.data.frame(HairEyeColor),
x = Eye,
counts = Freq,
ratio = c(0.2, 0.2, 0.3, 0.3),
type = "bayes"
)
# }
Run the code above in your browser using DataLab