We created a data set just for demonstrating how you would run a chi square goodness-of-fit test. You can download that file (chi square GOF.sav) from our list of data sets. The example data set is not very interesting. It is simply 50 flips of a quarter, with the flips recorded as either heads or tails (1 or 2, respectively). [Note that SPSS requires that the categories for the chi square goodness-of-fit test be coded numerically. Therefore, we used 1 and 2 to designate heads and tails instead of H and T.]
We start by opening the SPSS program and opening this data file, which gives us this screen. The chi square goodness-of-fit test is under the nonparametric test menu. We start by selecting the Analyze menu, the Nonparametric submenu, and the chi square choice, which gives us this screen.
We move our Coinflip variable to the test variable list, and click on All categories equal in the Expected values box. This is by far the most common model that we test with chi square. What we are testing is whether the data fit the model that the two possibilities (heads and tails) are equally likely.
It is possible to test more complex models, and if you do, you would enter the expected values of each category by clicking the values choice in the Expected Values box and entering the actual expected values for each category in order.
To run the analysis, you click OK, which gives you this screen. This output shows us that our data set had 22 heads and 28 tails and that the chi square for that configuration is is .72, which is well short of statistical significance (p-value equal to .396).
We have prepared an animation that will walk you through this procedure. To run the animation, simply click on the title of the animation in the table below.
Note that we do not recommend that you try to run the animations if you have a slow connection, such as a dial-up connection. You will find that the animations take forever to load with a slow connection.