# Confusion about z-test and chi square test on a very basic example

I am confused with the difference between z-test and chi square test.

In book Agresti 2007 An introduction to categorical data analysis, page 9, the author had an example of testing

Do a majority or minority of adults in US believe that a pregnant woman should be able to obtain an abortion.

The data is 400 "yes" and 493 "no" in a "yes or no" survey question. And want to test if $\pi=0.5$, where observed/empirical ratio $p=0.448$

The author uses a z-test, where

$z=(0.448-0.5)/\sqrt{0.5*0.5/893}=-3.1$

But should we use chi-square goodness of fit test where we comparing observed with theoretical distribution ($\pi=0.5$)? It seems they are the same in this case. Why?

• By z test of proportions, we usually mean two-sample test. Your test is one sample test. Without checking it, I believe that the test value 3.1 you've got is equal to the sq. root of the chi-square statistic of one-sample chi-square test you are speaking about. A better alternative here would be binimial (exact) test. – ttnphns Feb 1 '17 at 15:54
• Also see second answer here: stats.stackexchange.com/questions/2391/… – psarka Feb 1 '17 at 15:55
• and here stats.stackexchange.com/q/173415/3277. But both links are about two-sample test of proportions, which doesn't concern to the current Q. – ttnphns Feb 1 '17 at 15:58
• @ttnphns thanks i think your comments answered my question. a small question, the book says test value is $-3.1$, and if you calculate it it is $-3.1$, why you say positive? – Haitao Du Feb 1 '17 at 16:14
• It doesn't matter. You may rearrange the numerator terms. Also, z statistic is the sq. root (which is but positive) of chi-sq statistic (which is positive) – ttnphns Feb 1 '17 at 16:18