A Chi-Square Goodness of Fit Test is used to determine whether or not a categorical variable follows a hypothesized distribution.
For example, suppose a shop owner claims that an equal number of customers come into his shop each weekday.
To test this hypothesis, an independent researcher records the number of customers that come into the shop on a given week and finds the following:
- Monday: 50 customers
- Tuesday: 60 customers
- Wednesday: 40 customers
- Thursday: 47 customers
- Friday: 53 customers
We can perform a Chi-Square Goodness of Fit Test to determine if the data is consistent with the shop owner’s claim.
This following step-by-step example shows how to perform a Chi-Square Goodness of Fit Test in Google Sheets.
Step 1: Create the Data
First, let’s input the data into Google Sheets in the following format:
Note: There were 250 customers total. If the shop owner expects an equal number to come into the shop each day then he would expect 50 customers per day.
Step 2: Calculate the Difference Between Observed and Expected Values
The Chi-Square test statistic for the Goodness of Fit test is X2 = Σ(O-E)2 / E
- Σ: is a fancy symbol that means “sum”
- O: observed value
- E: expected value
The following formula shows how to calculate (O-E)2 / E for each row:
Step 3: Calculate the P-Value
Lastly, we will calculate the Chi-Square test statistic along with the corresponding p-value using the following formulas:
Note: The function CHISQ.DIST.RT(x, deg_freedom) returns the right-tailed probability of the Chi-Square distribution associated with a test statistic x and a certain degrees of freedom. The degrees of freedom is calculated as n-1. In this case, deg_freedom = 5 – 1 = 4.
The X2 test statistic for the test is 4.36 and the corresponding p-value is 0.3595.
Since this p-value is not less than 0.05, we fail to reject the null hypothesis. This means we do not have sufficient evidence to say that the true distribution of customers is different from the distribution that the shop owner claimed.