Hi, Are crimes and storms independent? I was expecting chi-square to tell me no, that a disproportionate number of crimes occur when there are storms. Where is my work incorrect? Thank you.
# Are crimes and storms independent? df <- data.frame(no_crime=c(11,32), crime=c(40,167)) rownames(df) = c("no_storm", "storm") df chi <- chisq.test(df) p <- chi$p.value cat("p = ",round(p,3), "\n") ifelse(p < .05, ("Reject the null hypothesis, and conclude that the two variables are in fact dependent."), ("Fail to reject the null hypothesis, and conclude that the two variables are in fact independent." ))