SPSS » Analysis with SPSS » Chi-Square Goodness-of-Fit Test

Chi-Square Goodness-of-Fit Test in SPSS

Objective

The Chi-Square Goodness-of-Fit test is used to determine whether a sample of data came from a population with a specific distribution.

Assumptions

  • One categorical variable, with two or more categories (see our guide on Types of Variable)
  • A hypothesized proportion (equal or unequal)
  • No more than 20% of expected frequencies have counts less than 5.

Example

A website owner, Christopher, wants to offer a free gift to people that purchase a subscription to his website. New subscribers can choose one of three gifts of equal value: an Amazon Gift Voucher, a cuddly toy, or free cinema tickets. After 1000 people have signed up, Christopher wants to review the figures to see if the three gifts offered were equally popular.

Set-up in SPSS

There are two methods of entering data into SPSS in order to run a Chi-Square Goodness-of-Fit test in SPSS. Common to both methods is a column in the SPSS data file for the categorical variable, which in this example, we shall name gift_type. We have assigned codes of "1" for the Amazon Gift Certificate and labelled it "Gift Certificate", "2" for the cuddly toy and labelled it "Cuddly Toy", and "3" for the free cinema tickets and labelled it "Cinema Tickets" (help on how to enter data can be found in our Entering Data in SPSS guide and how to code variables can be found in our Working with Variables guide). If the frequency data has already been summated for the various categories then we need to create a second column that contains the respective frequency counts; we have called this variable frequency. This type of data entry is shown below:

Chi-square Goodness of Fit Test Summated Setup

Published with written permission from SPSS Inc, an IBM Company.

Alternatively, you may have the data in raw form, i.e. you have not summated the frequencies. In this case, you do not need a second column as SPSS can calculate the frequencies of occurrence of each category for you. This would mean that, in this example, there are 1000 rows of data, of which the beginning of said data is shown below:

Chi-square Goodness of Fit Test Raw Data Setup

Published with written permission from SPSS Inc, an IBM Company.


Test Procedure in SPSS

Weighting cases if summation used

  1. Click Data > Weight Cases... on the top menu as shown below:
    Weighting Cases for Chi-square Goodness of Fit Test

    Published with written permission from SPSS Inc, an IBM Company.

  2. You will be presented with the Weight Cases dialogue box as shown below:
    Weighting Cases Dialogue Box

    Published with written permission from SPSS Inc, an IBM Company.

  3. Select the "Weight cases by" radio box and transfer the "frequency" variable into the "Frequency Variable:" box, which has now become highlighted, by using the SPSS Right Arrow Button button. You will get the following screen:
    Weighting Cases Dialogue Box with Transferred Variable

    Published with written permission from SPSS Inc, an IBM Company.

  4. Click the SPSS OK Button button.

Procedure for both methods

  1. Click Analyze > Nonparametric Tests > Legacy Dialogs > Chi-square... on the top menu as shown below: (If you are on older versions of SPSS you will not have to go through the Legacy Dialogs menu)
    Menu System for Chi-Square Goodness of Fit Test

    Published with written permission from SPSS Inc, an IBM Company.

  2. You will be presented with the Chi-square Test dialogue box, as shown below: (The "frequency" variable will only be present if you entered in your data in summated form)
  3. Chi-Square Test Dialogue Box

    Published with written permission from SPSS Inc, an IBM Company.

  4. Transfer the "gift_type" variable into the "Test Variable List:" box by using the SPSS Right Arrow Button button as shown below:
    Chi-Square Test Dialogue Box Transferred Variable

    Published with written permission from SPSS Inc, an IBM Company.

    [Keep the "All categories equal" option selecting in the "Expected Values" area as we are assuming equal proportions for each category.]

  5. Click the SPSS OK Button button to generate the output.

SPSS Output for Chi-Square Goodness-of-Fit Test

The table below, gift_type, provides the observed frequencies (Observed N) for each gift as well as the expected frequencies (Expected N), which are the frequencies expected if the null hypothesis is true. The difference between the observed and expected frequencies is provided in the Residual column.

SPSS Chi-Square Test Output Table - Observed and Expected Frequencies

Published with written permission from SPSS Inc, an IBM Company.

The table below, Test Statistics, provides the actual result of the Chi-Square Goodness-of-Fit test. We can see from this table that our test statistic is statistically significant: χ2(2) = 49.4, p < .0005. We can, therefore, reject the null hypothesis and conclude that there are statistically significant differences in the preference of the type of sign-up gift, with less people preferring the Cuddly Toy (N = 230) compared to either the Amazon Gift Certificate (N = 370) and Cinema Tickets (N = 400).

SPSS Chi-Square Test Output Table - Chi-Square Statistic

Published with written permission from SPSS Inc, an IBM Company.

The footnotes to the table inform us that there are no expected frequencies less than a count of 5, which means that we have not violated one of the assumptions of the Chi-Square Goodness-of-Fit test. We could, of course, have determined this from the values in the gift_type table but SPSS conveniently calculates the percentage for us in the Test Statistics table.

1
Share to Facebook Email to a Friend Share to Twitter Stumble It Delicious Digg This Yahoo MySpace Reddit
Other Laerd Websites Laerd Mathematics Laerd Referencing Laerd Dissertation