The chi square test is a statistical test. It is used to find whether the observed frequencies (O) are significantly different from the expected frequencies (E). The chi square analysis is used when there is a need to examine the similarities between two or more populations or variables on some characteristics of interest. Other statistical test does pair wise comparison, but the chi square can handle more than one variable or population at the same time.
Formula
The formula for calculating chi square test statistics,
`frX^2= (sum(OE)^2)/E`
Here,
O – Observed Frequency
E – Excepted Frequency
^{`frX^2` }– chi square
In this article we shall discuss about assumption of chi square test with suitable example problems.
Find the value of the chi square using the following data
Observed Frequency 
Excepted Frequency 
20 
10 
30 
20 
40 
30 
50 
40 
Solution:
The formula for calculating chi square test statistics,
`frX^2= (sum(OE)^2)/E`
Here,
O – Observed Frequency
E – Excepted Frequency
`frX^2` ^{ }– chi square
Observed Frequency 
Excepted Frequency 
OE 
(OE)^{2} 
(OE)^{2}/ E 

20 
10 
10 
100 
10 

30 
20 
10 
100 
5 

40 
30 
10 
100 
3.33 

50 
40 
10 
100 
2.5 




Total 
20.83 
`frX^2` =10+5+3.33+2.5
=20.83
The chisquare value is 20.83
A School has 1390 students; they were classified by gender (girls and boys) and by groups (G1, G2, and G3). Results are shown in the following table.

Groups 
Row total 

G1 
G2 
G3 

Girls 
200 
210 
250 
660 
Boys 
250 
260 
220 
730 
Column total 
450 
470 
470 
1390 
Is there a gender gap? Do the girls groups differ significantly from the boys group?
Solution:
Degree of freedom=(r1)*(c1)=(21)*(31)=2
E _{r,c}=(n_{r}*n_{c})/n
Here ,
rno. of rows
cno. of columns
nrtotal value of row
nctotal value of column
ntotal value of the row total (or) total value of the column total
E 1, 1= `(660 xx 450)/1390` = 213.7
E 1, 2=` (660 xx 770)/1390` = 223.2
E 1, 3= `(660 xx 770)/1390` =223.2
E 2, 1= `(730 xx 450)/1390` =236.3
E 2, 2=` (730 xx 470)/1390` =246.8
E 2, 3= `(730 xx 470)/1390` =246.8
`frX^2=sum [(Or,cEr,c)^2/E_(r,c) ]`
= `((200213.7)^2)/213.7 ` + `((210223.2)^2)/223.2` + `((250223.2)^2)/223.2`
+ `((250236.3)^2)/236.3 ` + `((260246.8)^2) /246.8` + `((220246.8)^2)/246.8`
= 0.8783+ 0.7806+ 3.2179+ 0.7943+ 0.7060+ 2.9102
= 9.2873
The Pvalue is the probability that a chi square having 2 degrees of freedom is more extreme than 9.2873
We use the chi square distribution Calculator to find P (`frX^2` < CV) = 0.99
P(`frX^2` > CV) =10.99
=0.01