[1] 3.25
[1] 0.1969117
STAT 200 – Introductory Statistics
February 11, 2026
If \(Z_1, \dots, Z_n\) are independent, standard Normal random variables, then:
\[ Q = \sum_{i = 1}^n Z_i \sim \chi_{\nu}^2, \]
is a chi-squared (\(\chi^2\)) distribution with \(\nu\) degrees of freedom.
Suppose we want to see if we have an idea of what distribution we think a categorical variable should be following. How do we test that?
I would like to test if my three-sided die is fair. To do this, I roll it \(n = 600\) times and tabulate the observed frequency distribution.
In those 600 rolls, I got \(n_1 = 180\) ones, \(n_2 = 215\) twos, and \(n_3 = 205\) threes.
I would like to test if my three-sided die is fair. To do this, I roll it \(n = 600\) times and tabulate the observed frequency distribution.
In those 600 rolls, I got \(n_1 = 180\) ones, \(n_2 = 215\) twos, and \(n_3 = 205\) threes.
That is, we are given the following information:
Note what information the above gives to us:
The goal is to create a test statistic that measures how far the observed counts are from the expected counts, while still having a distribution we know (or can determine).
It can be shown (in later STAT courses) that this test statistic approximately follows a chi-square distribution with \(k - 1\) degrees of freedom (if the \(\mu_i\) are large enough):
\[ TS = \sum_{i=1}^k \frac{(x_i - \mu_i)^2}{\mu_i} \]
It just requires that we can determine the expected value of each count, \(\mu_i\).
Recall from earlier that we have:
Where did the expected counts come from?
Recall from the Binomial distribution that \(\mu_i = n p_i\), where \(n\) is the number of rolls and \(p_i\) is the probability of the \(i^{th}\) outcome.
\[ \begin{aligned} TS &= \sum_{i=1}^k \frac{(x_i - \mu_i)^2}{\mu_i} \\ &= \frac{(x_1 - \mu_1)^2}{\mu_1} + \frac{(x_2 - \mu_2)^2}{\mu_2} + \frac{(x_3 - \mu_3)^2}{\mu_3} \\ &= \frac{(180 - 200)^2}{200} + \frac{(215 - 200)^2}{200} + \frac{(205 - 200)^2}{200} \\ &= \frac{(-20)^2}{200} + \frac{15^2}{200} + \frac{5^2}{200} \\ &= \frac{400}{200} + \frac{225}{200} + \frac{25}{200} \\ &= \frac{650}{200} \\ &= 3.250 \end{aligned} \]
How does this test statistic value (3.250) compare to the chi-squared distribution with \(k - 1 = 2\) degrees of freedom?
Conclusion:
We would like to test if the three-sided die is fair. To test this, we rolled the die 100 times. In those rolls, ones came us 180 times; twos, 215 times; and threes, 205 times. To test if there is significant evidence that the die is unfair, we use the chi-squared goodness-of-fit test.
Because the test’s \(p\)-value of 0.1969 is greater than our selected value of \(\alpha = 0.05\), we fail to reject the null hypothesis. There is not enough evidence to conclude that the die is unfair.
As an aside, we are also unable to conclude that the die is fair. In fact, this experiment gave us no additional information about the outcome distribution of the three-sided die.
R Code:
R Code:
Chi-squared test for given probabilities
data: c(180, 215, 205)
X-squared = 3.25, df = 2, p-value = 0.1969
Note: This is the process you should use if you are performing genuine statistical analysis.
My friend claims that the proportion of cars on the Knox campus that are American is the same as the proportion that are European and the proportion that are Asian. To test this, I went to the parking lot across Berrien from SMC and counted the cars and their origins. In that sample, there were 19 American cars, 23 Asian cars and 2 European cars.
From this, the observed and expected values are:
\[ \begin{aligned} TS &= \sum_{i=1}^k \frac{(x_i - \mu_i)^2}{\mu_i} \\ &= \frac{(x_1 - \mu_1)^2}{\mu_1} + \frac{(x_2 - \mu_2)^2}{\mu_2} + \frac{(x_3 - \mu_3)^2}{\mu_3} \\ &= \frac{(19 - \frac{44}{3})^2}{\frac{44}{3}} + \frac{(23 - \frac{44}{3})^2}{\frac{44}{3}} + \frac{(2 - \frac{44}{3})^2}{\frac{44}{3}} \\ &= \frac{\left( \frac{13}{3} \right)^2}{\frac{44}{3}} + \frac{\left( \frac{25}{3} \right)^2}{\frac{44}{3}} + \frac{\left( -\frac{38}{3} \right)^2}{\frac{44}{3}} \\ \end{aligned} \]
\[ \begin{aligned} TS &= \sum_{i=1}^k \frac{(x_i - \mu_i)^2}{\mu_i} \\ &= \frac{169}{132} + \frac{625}{132} + \frac{1444}{132} \\ &= \frac{2238}{132} \\ &\approx 16.954\dots \end{aligned} \]
How does this test statistic value (16.954) compare to the chi-squared distribution with \(k - 1 = 2\) degrees of freedom?
Conclusion:
We would like to test if the proportions of American, Japanese, and European cars are equal at Knox College. To test this, we examined the country-of-origin of cars in the parking lot on Berrien and Academy. In this lot, the number of American, European, and Japanese cars is 19, 23, and 2. To test if there is significant evidence that there is a difference in the origin proportions, we use the chi-squared goodness-of-fit test.
Because the \(p\)-value is much less than our selected value of \(\alpha = 0.05\), we reject the null hypothesis. We are able to conclude that the proportion of cars from the three regions is not the same.
R Code:
The Department of Mathematics claims that the proportion of its graduates who went to graduate school is twice the proportion of any other post-baccalaureate path.
To test this, the Department sent out a questionnaire to all of the alums for whom they had current addresses. Here is a table of our results from those who responded:
| Category | Grad School | Business | Education | Unemployed |
|---|---|---|---|---|
| Count | \(13\) | \(7\) | \(10\) | \(5\) |
| Expected | \(14\) | \(7\) | \(7\) | \(7\) |
\[ \begin{aligned} TS &= \sum_{i=1}^k \frac{(x_i - \mu_i)^2}{\mu_i} \\ &= \frac{(x_1 - \mu_1)^2}{\mu_1} + \frac{(x_2 - \mu_2)^2}{\mu_2} + \frac{(x_3 - \mu_3)^2}{\mu_3} + \frac{(x_4 - \mu_4)^2}{\mu_4} \\ &= \frac{(13 - 14)^2}{14} + \frac{(7 - 7)^2}{7} + \frac{(10 - 7)^2}{7} + \frac{(5 - 7)^2}{7} \\ &= \frac{(-1)^2}{14} + \frac{0^2}{7} + \frac{3^2}{7} + \frac{(-2)^2}{7} \\ &= \frac{1}{14} + 0 + \frac{9}{7} + \frac{4}{7} \\ &= \frac{27}{14} \approx 1.9286 \end{aligned} \]
How does this test statistic value (\(1.9286\)) compare to the chi-squared distribution with \(k - 1 = 3\) degrees of freedom?
Conclusion:
The Department of Mathematics at Knox College would like to determine if the proportion of its graduates who went to graduate school is twice the proportion of any other post-baccalaureate path. To test this, the department contacted its graduates. Of the \(35\) who responded, \(13\) attended graduate school, \(7\) went into business, \(10\) went into education, and \(5\) were unemployed. We used the chi-squared goodness-of-fit test to determine if the claim by the Department of Mathematics is reasonable.
Because the \(p\)-value of 0.5874 is greater than our selected value of \(\alpha = 0.05\), we cannot reject the null hypothesis. The claim made by the Department of Mathematics that twice as many of its graduates go to graduate school than any other category is reasonable, given the data.
R Code:
One initiative of Knox College is to become more representative of the US population. This raises a question of whether we have succeeded in terms of numbers.
According to Fall 2019 domestic numbers, the data are:
| Black | Asian | Hispanic | White | |
|---|---|---|---|---|
| Observed | \(109\) | \(71\) | \(194\) | \(635\) |
| Population | \(0.1606\) | \(0.0709\) | \(0.2312\) | \(0.5389\) |
Note: Here, we only focus on these four groups. While there are others, their numbers are low.
Here is a graphic showing where we were in Fall 2019. The dots represent the observed proportion.
In terms of the calculations, we have:
Error in chisq.test(x = c(109, 73, 214, 635), p = c(0.1606, 0.0709, 0.2312, : probabilities must sum to 1.
What happened? How do we fix it?
The fix to the problem of probabilities not summing to one is to include the flag:
Conclusion:
We would like to test if the proportions of selected racial-ethnic groupings for domestic students are the same between Knox College and the population of the United States. To test this, we examined the racial-ethnic distribution of students at Knox College in 2019 and compared these counts to the expected counts using the chi-squared goodness-of-fit test.
Because the \(p-\)value of less than 0.0001 is much less than our selected value of \(\alpha = 0.05\), we reject the null hypothesis. The distribution of domestic students at Knox College does not currently match the demographic distribution of people in the United States.