Chi square Test for Goodness of Fit

By Anthony M. Wanjohi:

Chi square is a non-parametric test commonly used to test either goodness of fit or association between two categorical variables (test of independence).  Categorical variables are grouped as nominal (names), ordinal (ordered) or dichotomous (binary). The purpose of this article is to illustrate chi square test for goodness of fit commonly used to analyze whether a frequency distribution for a categorical variable is consistent with expectations. 

In order to apply the chi-square for goodness of fit test, the following are computed: Observed frequencies (Observed N), expected frequencies (Expected N), residual and test statistics. 

Observed frequencies are the number of occurrences, expected frequencies are the frequencies expected if the null hypothesis is true (no difference)  and residual is the difference between the observed and expected frequencies (Lund Research, 2013). Test statistics provide the probability value for determination of statistical significance. 


For the purpose of illustration, chi square for goodness of fit test for marital status (nominal variable) is computed. The output based on SPSS aided computation are shown by Tables 1 and 2.  

Table 1: Marital status

Observed N Expected N Residual
Single 52 37.3 14.8
Married 21 37.3 -16.3
Divorced 70 37.3 32.8
Widow 6 37.3 -31.3
Total 149


Table 2: Test Statistics

Marital status
Chi-Square(a) 67.940
df 3
Asymp. Sig. .000

a  0 cells (.0%) have expected frequencies less than 5.
The minimum expected cell frequency is 37.3.

As illustrated by Table 2, test Statistics are statistically significant. Therefore, the null hypothesis is rejected and concluded that there is a statistical significant difference in marital status with more people being divorced/ separated as compared to single (52), married (21) and widowed (6).


Lund Research (2013). Chi-Square Goodness-of-Fit Test in SPSS. Retrieved from

Leave a Reply

Your email address will not be published. Required fields are marked *