The chi square calculator will help you conduct the goodness of fit test, also known as the chi square test. This statistics is used when you want to determine whether your data is consistent with the expected distribution. Read on to learn how to calculate the chi square value and how to use the chi square tables to determine the quality of your data. Make sure to take a look at out p-value calculator, too!
What is the chi square test?
Imagine that you are a teacher at high school. You grade a test, giving the notes 2 (the worst) to 5 (the best). You expect to give 15% of students to obtain grade 5, 40% to obtain a 4, 30% to get a 3 and 15% to fail by getting a 2. Once you grade papers of one class, you can test how your grading differs from the intended distribution using the chi square test calculator. It is simply a test that measures how the observed values differ from the expected ones.
How to calculate chi square?
You can find the chi square value, using the following formula:
χ2 = (observed value - expected value)^2 / expected value
For example, you wanted to give 15% of your students grade 5. You ended up grading 5 out of 60 students with this highest note. 15% of 60 students is 9 students. Hence, the chi square statistic is
χ2 = (5 - 9)^2 / 9 = (-4)^2 / 9 = 16/9 = 1.778
What does this information mean? You can use the chi square tables (I'm sorry, the source is no longer online) to compare this value with other ones. There are two different factors in such a table:
- Degrees of freedom: Number of levels of the analyzed variable minus one. For instance, in our grading example we had four levels (grade 2, 3, 4 and 5). Hence, the number of degrees of freedom is equal to 3.
- Significance level: it is denoted as a subscript next to the symbol χ2. This is the probability of rejecting your hypothesis when it was in fact true. The higher this risk is, the more extreme data is accepted as still valid.
Using chi square calculator: an example
Let's analyze the situation with paper grading in greater detail. Let's say you have 60 students and graded them in a following way: five received a 5, twenty-two a 4, twenty-six a 3 and seven a 2.
- Calculate how many students were expected to receive each grade according to the planned distribution.
- Grade 2: 0.15 * 60 = 9
- Grade 3: 0.30 * 60 = 18
- Grade 4: 0.40 * 60 = 24
- Grade 5: 0.15 * 60 = 9
- Calculate the chi square value for each grade.
- Grade 2:
χ2 = (5 - 9)^2 / 9 = 1.778
- Grade 3:
χ2 = (26 - 18)^2 / 18 = 3.556
- Grade 4:
χ2 = (22 - 24)^2 / 24 = 0.167
- Grade 5:
χ2 = (7 - 9)^2 / 9 = 0.444
- Sum all of the chi square values.
χ2 = 1.778 + 3.556 + 0.167 + 0.444 = 5.945
- Determine the number of degrees of freedom. In this case, we have 3 degrees of freedom.
- What is your significance level? We can assume that it is equal to 0.05.
- You can now use the chi square tables to determine whether our data can be accepted as consistent with the initial distribution. For 3 degrees of freedom and significance level 0.05, the maximum admissible value of chi square is 7.815. As
χ2 = 5.945, we are in the admissible range - the grading is not far off from the initial distribution.