I am interested to see if there is any relationship between eye color and whether someone is a vegan or not. The data is as follows:
Vegan Non vegan Blue 29 23 Green 15 32 Brown 3 9
I ran a Chi-squared test of association and the result is significant.
Pearson's Chi-squared test data: vegan X-squared = 7.4115, df = 2, p-value = 0.02458
However, when I ran the post-hoc of this, it turns out the p-values are not significant.
Adjusted p-values used the bonferroni method. comparison raw.p adj.p 1 Blue vs. Green 0.0255 0.0766 2 Blue vs. Brown 0.1069 0.3206 3 Green vs. Brown 0.7388 1.0000
What does this mean? If I look at the counts and expected counts of each group, I can see that people who are vegan tend to have blue eyes, and non-vegan tend to have green eyes.
R code you can try:
library(fifer) vegan <- matrix(c(29,15,3,23,32,9), nrow = 3, dimnames = list(c("Blue", "Green", "Brown"), c("Vegan", "Non vegan"))) chisq.test(vegan) chisq.post.hoc(vegan, control = "bonferroni")