I have a binary response variable (0s and 1s), the distribution of which that I want to compare to chance. I understand I could use logistic regression or a chi-square test to do this and that these should be equivalent but my results are slightly different when I use one versus the other and I'm wondering why.
Specifically, there are 44 1s and 14 0s and the expected distribution would be chance (30 1s, 30 0s). When I run a logistic regression with this code:
model<-glm(df$var ~ 1, family=binomial("logit"))
I get a z value of 3.465, which converts to a Wald statistic of 12, and p = .00053.
When I run a chi-square test I get X-squared = 13.067, df = 1, p-value = 0.0003006.
Can someone explain to me where exactly these tests differ such that they yield different results?