Thursday, 8 March 2018

Chi-Square Goodness of Fit Example - Step by Step Procedure

256 musicians were polled to determine their zodaic sign. The results are given below
Aries 29
Torus 24
Gemini 22
Cancer 19
Leo 21
Virgo 18
Libra 19
Scorpio 20
Sagittarius 23
Capricorn 18
Aquarius 20
Pisces 23

Test the hypothesis that the zodaic signs are evenly distributed accross the musicians.

Solution Steps
Get the excel sheet for this question
The formular for chi-square is
O = Observed values
E = Expected value

Step 1: State the null and alternate hypothesis
H0: The values are evenly distributed
Ha: The values are not evenly distributed

Acceptance criteria for the null value is for large p-Value. (we would calculate this)
Rejection criteria is when p-value is low.

Step 2:Create the Table
I have created the table in Excel as shown below

Step 3: Calculate the Expected Value
The expected value corresponds to the mean of the samples  and has been calculated as 21.33.

Step 4: Calculate the Difference
This is given by the formular Observed Value - Expected Value (O - E) for each of the observations.

Step 5: Calculate the Squared Difference
This is the square of the value calculated in Step 4. The values are shown in Table 3.

Step 6: Calculate the Component
This is given by the chi-square formula

Calculate this value for each of the squared values
At this point the excel sheet would look like the one below

Table 3: Final Chi-Square Table

Step 7: Calculate the Chi-Square Statitic
You can easily find this value by taking the sum of the last column.
Chi-Square test statistic = 5.09

Step 8: Find the p-Value
You can find the p-value using the calculate chi-square statistic and the degrees of freedom

Degrees of freedom is given by N-1
df = 12 - 1 = 11
where N is the number of observations in this case
See statistical tables here

From the chi-square table we get a p-value of between 0.900 and 0.950.

Step 9: State the Conclustion
In chi-square, the null-hypotheis is accepted if the p-value is very large, say 90% to 100% and we reject the null hypothesis for small values of p-value.

In this case, the p-value is between 90% and 95%. Therefore, we accept the null hypothesis.

Get this excel file