# 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 <- matrix(
c(
71, 30,
50, 100
),
nrow = 2, byrow = TRUE,
dimnames = list(
Diagnosis = c("Sick", "Recovered"),
Group = c("Treatment", "Control")
)
)) # note groups are COLUMNS
oddsratio(RCT)
riskratio(RCT)
cohens_h(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