# Consider an experiment with two conditions, each with 100 participants.
# Each participant chooses between one of following three parties.
cond1 <- c(40, 25, 35)
cond2 <- c(25, 35, 45)
mat <- cbind(cond1, cond2)
rownames(mat) <- c( 'party1', 'party2', 'party3')
# To test the null hypothesis that the distribution of preferences
# is identical in the two conditions, we run a chi-square test:
stats::chisq.test(mat) # still significant
# However, if we want to estimate the effect size, we then use Cramer's V:
calc.CV(mat)
# Agresti (2002), table 3.10, p. 104
# 1991 General Social Survey: The effect size of race on party identification.
gss <- data.frame(
expand.grid(race=c("black", "white"),
party=c("dem", "indep", "rep")),
count=c(103,341,15,105,11,405))
GSS = untable(gss, freq = "count")
calc.CV(GSS$race, GSS$party)
Run the code above in your browser using DataLab