I'm trying to test the difference in proportions using the z test method and chi-squared method, but am getting very different answers. Is that normal?
My data:
CI CII
Male 205 102
Female 83 39
Calculating the z score I get 0.25 which should correlate to a p-value of 0.4013. Calculating the chi-squared score I get 0.0626 correlating to a p-value of 0.8025.
I read that the z-score requires some assumptions (probability of success is ~0.5 and n is high). Is this violating those? Or is it just the nature of these different approaches that gives very different answers with the same meaning (no evidence of difference).
I'm certainly open to miscalculations, but I've re-checked. If this behaviour isn't normal I'll recheck again!
Here are my calculations in R.
> r1 <- 205
> r2 <- 102
> n1 <- 288
> n2 <- 141
> (p1 <- r1/n1)
[1] 0.7118056
> (p2 <- r2/n2)
[1] 0.7234043
> (common.proportion <- (r1+r2)/(n1+n2))
[1] 0.7156177
> (se.pooled <- sqrt(common.proportion*(1-common.proportion)*(1/n1+1/n2)))
[1] 0.0463676
> (zscore <- (p1-p2)/se.pooled)
[1] -0.2501466
>
> # chi-squared
> prop.test(c(205,102), c(288,141), correct = FALSE)
2-sample test for equality of proportions without continuity
correction
data: c(205, 102) out of c(288, 141)
X-squared = 0.0626, df = 1, p-value = 0.8025
alternative hypothesis: two.sided
95 percent confidence interval:
-0.10208385 0.07888645
sample estimates:
prop 1 prop 2
0.7118056 0.7234043