Most people have heard of chi-squared test, but not many know that there are (at least) two types of chi-squared tests.
The two most common chi-squared tests are:
- 1-way classification: Goodness-of-fit test
- 2-way classification: Contingency test
The goodness-of-fit chi-squared test is to test proportions, or to be precise, to test if an an observed distribution fits an expected distribution.
The contingency test (the more classical type of chi-squared test) is to test the independence or relatedness of two random variables.
The best website I found regarding how to practically code (in R) for the two chi-squared tests is: https://web.stanford.edu/class/psych252/cheatsheets/chisquare.html
I created a PDF copy of the above site, in case it becomes unavailable in the future:
Best Videos on each type of Chi-squared test
Goodness of fit Chi-squared test video by Khan Academy:
Contingency table chi-square test: