# NOT RUN {
# Phi coefficient for 2x2 tables
tab <- table(sample(1:2, 30, TRUE), sample(1:2, 30, TRUE))
phi(tab)
# Cramer's V for nominal variables with more than 2 categories
tab <- table(sample(1:2, 30, TRUE), sample(1:3, 30, TRUE))
cramer(tab)
# formula notation
data(efc)
cramer(e16sex ~ c161sex, data = efc)
# bootstrapped confidence intervals
cramer(e16sex ~ c161sex, data = efc, ci.lvl = .95, n = 100)
# 2x2 table, compute Phi automatically
xtab_statistics(efc, e16sex, c161sex)
# more dimensions than 2x2, compute Cramer's V automatically
xtab_statistics(efc, c172code, c161sex)
# ordinal data, use Kendall's tau
xtab_statistics(efc, e42dep, quol_5, statistics = "kendall")
# calcilate Spearman's rho, with continuity correction
xtab_statistics(efc,
e42dep,
quol_5,
statistics = "spearman",
exact = FALSE,
continuity = TRUE
)
# }
Run the code above in your browser using DataLab