Chi-Square Test

I think it is generally agreed upon that the Chi-square test (specifically, the chi-square test for a 2-by-2 contingency table) is a non-parametric test. (Though there is the assumption that each "cell" has an expected outcome of greater than 5).

z-test of two proportions

The z-test for two proportions, on the other hand, is used when you have two proportions which ascribe to the binomial distribution. You can then "approximate" the normal distribution from X~B(n, p) to X~N(np, npq) with the caveat that np and nq are both greater than 5. Some therefore say that because one is using an underlying z-distribution, or that because one has approximated the binomial to the normal distribution (and made this assumption), that the z-test for two proportions is a "parametric" test.

Yet... the Chi-square test is actually identical to the z-test for two proportions - i.e. if you calculate the p-value from either the chi-square test or the z-test of two proportions, they will yield the same p-value. Furthermore, it probably is useful to note that the z^2 statistic is identical to the chi statistic.

Assuming my stated premises are all correct (please correct me if they are not!), my questions are therefore:

  1. Given equivalence of both tests, is it more correct to say that the z-test and the chi-square test are both parametric tests or non-parametric tests?

  2. Follow up from Q1: if we classify them both as "parametric", is there a non-parametric counterpart? Vice versa; if we classify them both as "non-parametric", is there a "parametric" counterpart?

  3. In special circumstances when there are only two groups, the z-test should theoretically give slightly more information. This is because the z-test also gives directionality (i.e. group 1's probability has a higher or lower probability than group 2's probability). Is this correct?

(For those who would like simulation proof of the equivalence of z-test for two proportions and the chi-square test, please copy/paste the following code into R v3.5.2... it should give mostly identical p-values between the two tests depending on rounding error).

### Contrive proportions data
#p1 = probability of event occuring in group 1 (2dp)
#p2 = probability of event occuring in group 2 (2dp)

#note, the probabilites are constrained to >0.05 and <0.95 to fulfil assumptions
p1 = round(runif(1,min=0.05,max=0.95),2)
p2 = round(runif(1,min=0.05,max=0.95),2)

#for simplicity's sake, let's assume n=1000
n1 = 1000
n2 = 1000

q1 = 1-p1
q2 = 1-p2

## Conduct the z-test for two proportions using formulas
#pooled probability (p-hat)
p = (n1*p1 + n2*p2) / (n1 + n2)
#z-test formula
z = (p1 - p2) / sqrt(p*(1-p)*(1/n1 + 1/n2))
#convert z-value to p-value (assume 2 tailed)
p_value_from_ztest = 2*pnorm(-abs(z))

## Convert proportions data into matrix for chi-square test
matrix = as.table(rbind(c(p1*n1, p2*n2), c(q1*n1, q2*n2)))
dimnames(matrix) = list(occurrence = c("YES", "NO"),
                        group = c("1", "2"))
p_value_fromchisq = chisq.test(matrix, correct = F)$p.value

### Compare pvalue from z-test and chi-square test
#round to 10sigfig to avoid the rounding errors from earlier calculations...
p_ztest = signif(p_value_from_ztest, 10)
p_chisq = signif(p_value_fromchisq, 10)
identical(p_ztest, p_chisq)

1 Answer 1


Q1, Q2: As you noticed, both tests are the same with the only difference that in chi square test you do all operations in second power ($z^2$ = $\chi^2$). Non-parametric tests in general work with distributions that can’t be described with finite number of parameters. Following this logic, if you use your test (chi square, z-test) for categorical (nominal) data, it is parametric. If you use them for continuous data that were discretized into categories (because the shape of original distribution was difficult to handle), you can consider both tests as non-parametric. However, I find no purpose in defining sharp line between parametric and non-parametric statistic.

Q3: You are correct.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.