summary of Chi-Square test steps:
We can calculate the chi square statistic x2 by folllwing the
beneath steps:
-
Define the hypothesis set as :
-
Ho: The two categorical variables are independent.
Ha: The two categorical variables are related.
- The Expected number , E, can be calculated as Sum of Row * Sum
of Column divided by total observations
- For each observed number in the table subtract the
corresponding expected number (O — E).
- Square the difference [ (O —E)2 ].
- Divide the squares obtained for each cell in the table by the
expected number for that cell [ (O - E)2 / E ].
- Sum all the values for (O - E)2 / E. This is the chi square
statistic.
- Now, get the degree of freedom, df, using the formula
(r-1)*(c-1) for the contingency table that has r rows and
c columns,
- Now, for the Chi-Square statistic(X^2) , and degree of freedom
(df) get the p-value by the following formula or from the
Chi-Square table. Excel formila = 1- CHISQ.DIST( X^2, df,
TRUE)
- If p-value < alpha, we reject Ho and conclude that variables
aren't independent. If p-value > alpha, we fail to reject Ho and
say that the variables are independent.
***please comment if you have any doubts.Happy to help
you.Thank you. Please Like.