In statistics, various measurement methods are popularly used. For many experimental studies, we need a chi-square test to get conclusions. It is one of the most useful non-parametric statistics. The Chi Square test is used for data collection consist of people distributed across various categories. And to know that whether the distribution is different from what would expect. In this topic, we will discuss the Chi Square formula with examples. Let us discuss it!
Chi Square Formula
What is Chi-Square?
Chi-square is a method that is used in statistics and it calculates the difference between observed and expected data values. It is used to find out how closely actual data fit with expected data. The value of chi-square will help us to get the answer to the question as to the significance of the difference in expected and observed data statistically. A small chi-square value will tell us that any differences in actual and expected data are due to some usual chance.
And hence the data is not statistically significant. Also, a large value will tell that the data is statistically significant and there is something causing the differences in data. From there, a statistician may explore factors that may be responsible for the differences.
Chi is a Greek symbol that looks like the letter x as we can see it in the formulas. To calculate the chi-square, we will take the square of the difference between the observed value O and expected value E values and further divide it by the expected value. Depending on the number of categories of the data, we end up with two or more values. Chi-square is the sum total of these values. However, the value that we are looking for is chi-square, we do not need to take the square root.
A very small Chi-Square test statistically means that the observed data fit in the expected data extremely well. A very large Chi-Square test statistically means that the data does not fit very well. If the chi-square value is very large, then we have to reject the null hypothesis.
Chi-Square is one way to show the relationship between two categorical variables. Generally, there are two types of variables in statistics such as numerical variables and non-numerical variables.
Formula for the Chi-Square Test
The Chi-Square is denoted by\(\chi ^2\) and the formula is:
\(\chi ^2 = \sum \frac{(O-E)^2}{E}\)
Where,
- O: Observed frequency
- E:Â expected frequency
- \(\sum\):summation
- Chi 2 :Chi Square Value
Solved Examples Chi Square Formula
Q.1: Which pet will you prefer?
Cat | Dog | |
Men | 207 | 282 |
Women | 231 | 242 |
Solution: Lay the data out in a table:
Cat | Dog | |
Men | 207 | 282 |
Women | 231 | 242 |
Now, add up rows and columns:
Cat | Dog | Total | |
Men | 207 | 282 | 489 |
Women | 231 | 242 | 473 |
Total | 438 | 524 | 962 |
Now, calculate the Expected Value for each entry:
Cat | Dog | Total | |
Men | 222.64 | 266.36 | 489 |
Women | 215.36 | 257.64 | 473 |
Total | 438 | 524 | 962 |
Now, subtract expected from actual, square it, then divide by expected:
Cat | Dog | Total | |
Men | \((207-222.64)^2 = 222.64\) | \((282-266.36)^2 = 266.36\) | 489 |
Women | \((231-215.36)^2 =Â 215.36\) | \((242-257.64)^2 = 257.64\) | 473 |
Total | 438 | 524 | 962 |
Which is:
Cat | Dog | Total | |
Men | 1.099 | 0.918 | 489 |
Women | 1.136 | 0.949 | 473 |
Total | 438 | 524 | 962 |
Adding up these values:
1.099 + 0.918 + 1.136 + 0.949Â which is 4.102
Chi-Square is 4.102. Thus variable is not independent.
I get a different answer for first example.
I got Q1 as 20.5
median 23 and
Q3 26