# NOT RUN {
M <- rbind(
c(150, 130, 35, 55),
c(100, 50, 10, 40),
c(165, 65, 2, 25)
)
dimnames(M) <- list(
Study = c("Psych", "Econ", "Law"),
Music = c("Pop", "Rock", "Jazz", "Classic")
)
M
phi(M)
cramers_v(M)
## 2-by-2 tables
## -------------
RCT <- rbind(
c(30, 71),
c(100, 50)
)
dimnames(RCT) <- list(
Diagnosis = c("Sick", "Recovered"),
Group = c("Control", "Treatment")
)
RCT # note groups are COLUMNS
oddsratio(RCT)
riskratio(RCT)
## Dependent (Paired) Contingency Tables
## -------------------------------------
Performance <- rbind(
c(794, 86),
c(150, 570)
)
dimnames(Performance) <- list(
"1st Survey" = c("Approve", "Disapprove"),
"2nd Survey" = c("Approve", "Disapprove")
)
Performance
cohens_g(Performance)
# }
Run the code above in your browser using DataLab