STAT 3120 Statistical Methods I. Lecture 8 Chi-Square. STAT3120 – Chi Square. STAT3120 – Chi Square. When presented with categorical data, one common method of analysis is the “Contingency Table” or “Cross Tab”. This is a great way to display frequencies -
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Using this data, we could create the following 2x2 matrix:
The answers to these questions help us start to understand if promotion status and gender are related.
Specifically, we could test this relationship using a Chi-Square. This is the test used to determine if two variables are related.
The relevant hypothesis statements for a Chi-Square test are:
H0: Variable 1 and Variable 2 are NOT Related
Ha: Variable 1 and Variable 2 ARE Related
Develop the appropriate hypothesis statements and testing matrix for the gender/promotion data.
The Chi-Square Test uses the Χ2test statistic, which has a distribution that is skewed to the right (it approaches normality as the number of obs increases). You can see an example of the distribution on pg 641.
The Χ2test statistic calculation can be found on page 640.
The observed counts are provided in the dataset.
The expected counts are the counts which would be expected if there was NO relationship between the two variables.
Going back to our example, the data provided is “observed”:
What would the matrix look like if there was no relationship between promotion status and gender? The resulting matrix would be “expected”…
From the data, 25% of all employees were promoted. Therefore, if gender plays no role, then we should see 25% of the males promoted (75% not promoted) and 25% of the females promoted…
Notice that the marginal values did not change…only the interior values changed.
Now, calculate the X2 statistic using the observed and the expected matrices:
3.33+1.11+5+1.67 = 11.11
This is conceptually equivalent to a t-statistic or a z-score.
To determine if this is in the rejection region, we must determine the df and then use the table on page 732.
Df = (r-1)*(c-1)…
In the current example, we have two rows and two columns. So the df = 1*1 = 1.
At alpha = .05 and 1df, the critical value is 3.84…our value of 11.11 is clearly in the reject region…so what does this mean?
From the book Outliers, Malcolm Glidewell makes the point that the month in which a boy is born will determine his probability of playing in the NHL.
The months of birth for players in the NHL are on the next page…
(data taken from
Now, if there is NO relationship between birth month and playing hockey, what SHOULD the distribution of months look like?
Lets do this one in EXCEL…
Note that this is technically referred to as a “goodness of fit” test – where we are assessing if the actual distribution “fits” what would be expected.
Practice Problems for Chi-Square:
For all of these, identify the hypothesis statements, the testing matrix, and the decision.
Using credit data.
Great golf Bad Golf
Great golf Bad Golf
Column 1 Column 1 … Column 1
No association between Row and Column variable the expected percentage in any R*C will be equal to the percentage in that cell rows (R/T) times the percentage in the cell column (C/T). The expected percentage times the total sample size.
Prob of Yes outcome in Group B = 90/100 (.90)
Prob of a No Outcome in Group B = 10/100 (.10)
Odds ratio of Group B to Group A is 3 times .
Calculate cell Chi-square
P-value is 0.0307<.05 , reject the Null hypothesis
Appendix A.5: .05<p-value<.025
Cramer’s V indicates association is relatively weak.
Relative Risk at 95% CI that Males in the right column (+100) compared to Females has value of .6458. Males has a 65% odds of purchasing more then $100
Odds ratio (OR-1)*100, (0.6458-1)*100=-35.42%, males have a 35.42% lower odds than females.