In: Statistics and Probability
cite and explain how chi square is utilized in stat analysis by giving an example including constructing a 2x2 table
Ans:
Chi-square Test of Independence is used to check the relationship between two variables(whether independent or dependent).
H0: In the population, the two categorical variables
are independent.
Ha: In the population, two categorical variables are
dependent.


| Observed count(fo) | |||
| favor | opposed | total | |
| democrat | 138 | 64 | 202 | 
| republican | 64 | 84 | 148 | 
| total | 202 | 148 | 350 | 
| Expected count(fe) | |||
| favor | opposed | total | |
| democrat | 116.58 | 85.42 | 202 | 
| republican | 85.42 | 62.58 | 148 | 
| total | 202 | 148 | 350 | 
| Chi square=(O-E)^2/E | |||
| favor | opposed | total | |
| democrat | 3.934 | 5.370 | 9.305 | 
| republican | 5.370 | 7.329 | 12.699 | 
| total | 9.305 | 12.699 | 22.004 | 
Test statistic:
Chi square=22.004
df=(2-1)*(2-1)=1
p-value=chidist(22.004,1)=0.0000
As,p-value<0.05,we reject the null hypothesis.There is sufficient evidence to conclude that two categorical variables are dependent.