LU 4 Lecture Notes
📚 LU 4 Lecture Notes_copy.pdf
Brief overview
This document introduces Chi-squared hypothesis tests, fundamental tools for analyzing categorical data. Understanding these tests is crucial for determining relationships and distributions within datasets.
Key points
- Introduction to the Chi-squared distribution and its properties
- How to use the Chi-squared table for critical values
- Overview of the Chi-squared goodness-of-fit test for single variables
- The Chi-squared test of independence for analyzing associations between two variables
- Detailed steps for conducting Chi-squared hypothesis tests
1. Introduction to Chi-Squared Hypothesis Tests
1.1 Understanding the Chi-squared distribution
The Chi-squared distribution (²) is a continuous distribution used in hypothesis testing. It is positively skewed and its shape depends on the degrees of freedom.
Chi-squared values are always positive. This distribution helps us compare observed frequencies with expected frequencies.
The Chi-squared table is key to finding critical values. It uses degrees of freedom and the significance level (alpha, ).
The table has critical values for upper tail areas.

Chi-squared distribution: Right-skewed, always positive, depends on degrees of freedom.
1.2 Chi-squared goodness-of-fit tests
A Chi-squared goodness-of-fit test checks if a variable's observed distribution significantly differs from its expected distribution. The expected distribution can be:
- Equal proportions across all categories.
- Proportions that match a known distribution.
For these tests, each category must have an expected frequency of at least 5 4.
1.2.1 Steps for a Chi-squared hypothesis test
Hypothesis testing with Chi-squared follows a structured process.
- State Hypotheses: Define the null (H0) and alternative (H1) hypotheses.
- For equal proportions: H0:π1=π2=⋯=πk, H1: At least one proportion differs.
- For a known distribution: H0: Distribution follows a known pattern, H1: At least one proportion differs 5.
- Identify Rejection Region: Use the significance level (α) and degrees of freedom (df=k−1) to find the critical value from the ² table. k is the number of categories.
- Calculate Test Statistic: Compute the ² test statistic using observed (fo) and expected (fe) frequencies.
χ2=∑fe(fo−fe)2
- Observed frequencies (fo) are the actual counts.
- Expected frequencies (fe) are calculated as n×πi, where n is the total sample size and πi is the expected proportion for category i 6.


- Make a Decision: Compare the test statistic to the critical value. Reject H0 if the test statistic falls within the rejection region.
- Reach a Conclusion: Interpret the decision in the context of the problem. If H0 is rejected, there is sufficient evidence to support H1 7.
Test statistic: Sum of Expected(Observed−Expected)2 for all categories.
1.2.2 Example: Taste test preferences
A company tested consumer preferences for 4 products (A, B, C, D) with 120 consumers. Preferences were: A=24, B=45, C=30, D=21.
Test at the 5% significance level for brand preference.
| Category | Observed (fo) | Expected (fe) | fe(fo−fe)2 |
|---|---|---|---|
| A | 24 | 30 | 30(24−30)2=1.20 |
| B | 45 | 30 | 30(45−30)2=7.50 |
| C | 30 | 30 | 30(30−30)2=0.00 |
| D | 21 | 30 | 30(21−30)2=2.70 |
| Total | 120 | 120 | 11.40 |
- Hypotheses: H0: All proportions are equal (πA=πB=πC=πD=0.25). H1: At least one proportion is different 8.
- Degrees of freedom: df=4−1=3.
- Critical value: At α=0.05 and df=3, the critical value is 7.815 9.
- Test statistic: χ2=11.40.
- Decision: Since 11.40>7.815, reject H0.
- Conclusion: There is sufficient evidence of brand preference.
- The p-value is 0.0098. This means there is a 0.98% chance of observing such extreme results if there were no brand preference 11.
This test helps determine if observed counts in categories differ from what's expected by chance.
1.2.3 Example: Changing market share
A company's cold drink brands (A, B, C) historically had market shares of 50% (A), 30% (B), and 20% (C). Recent sales: A=130, B=75, C=35 units.
Test at the 10% significance level.
| Category | Observed (fo) | Expected (fe) | fe(fo−fe)2 |
|---|---|---|---|
| A | 130 | 120 | 120(130−120)2=0.83 |
| B | 75 | 72 | 72(75−72)2=0.13 |
| C | 35 | 48 | 48(35−48)2=3.52 |
| Total | 240 | 240 | 4.48 |
- Hypotheses: H0: Distribution is 50% A, 30% B, 20% C. H1: At least one proportion is different 12.
- Degrees of freedom: df=3−1=2.
- Critical value: At α=0.10 and df=2, the critical value is 4.605.
- Test statistic: χ2=4.48.
- Decision: Since 4.48<4.605, fail to reject H0.
- Conclusion: There is insufficient evidence to suggest the market share distribution has changed.
- The p-value is 0.1065. This means there is a 10.65% chance of observing these sales figures if the historical market shares were still true 15.
When interpreting p-values, remember: p-value < leads to rejecting H0.
🔑 Important: The Chi-squared distribution's critical value is found using degrees of freedom and the significance level13.
📝 Example: A small expected frequency (less than 5) in any category invalidates the Chi-squared test.
🔑 Important: For Chi-squared goodness-of-fit tests, the test statistic is always positive and the rejection region is always in the right tail 2 3.
2. Chi-squared test of independence
2.1 Purpose and hypotheses
The Chi-squared test of independence assesses if there's a relationship between two categorical variables. It uses data from a contingency table, which cross-tabulates the levels of the two variables.
The null hypothesis (H0) states that the variables are independent. The alternative hypothesis (H1) states that they are dependent.
- Null hypothesis (H0): The two variables are independent, unrelated, or not associated.
- Alternative hypothesis (H1): The two variables are dependent, related, or associated.
2.2 Calculating expected frequencies and the test statistic
Expected frequencies (fe) are calculated assuming the null hypothesis is true. They represent the frequencies you'd expect if the variables were independent.
A key requirement is that all expected frequencies must be at least 5. The test statistic measures the difference between observed (fo) and expected frequencies 18.
The formula for expected frequency for cell (i, j) is: fe(i,j)=sample size(row i total)×(column j total).
The Chi-squared test statistic is calculated as: χ2=∑fe(fo−fe)2.

2.3 Determining the critical value and making a decision
To find the critical value, you need the level of significance and the degrees of freedom (df). The degrees of freedom are calculated as df = (r – 1)(c – 1), where 'r' is the number of rows and 'c' is the number of columns in the contingency table.
You then compare this calculated test statistic to the critical value from a Chi-squared distribution table.
- If the test statistic falls within the rejection region (i.e., it's greater than or equal to the critical value), you reject H0.
- If the test statistic falls outside the rejection region (i.e., it's less than the critical value), you fail to reject H0.

🔑 Important: The distribution used for this test is a probability distribution, typically bell-shaped with a peak at the beginning and decreasing tails.
2.4 Drawing a conclusion and interpreting results
If you reject H0, there is sufficient evidence to support the alternative hypothesis that the two variables are dependent. If you fail to reject H0, there is insufficient evidence to claim the variables are dependent 19.
The following exercise illustrates these steps:
📝 Example: A study surveyed 60 city dwellers and 40 rural dwellers about a TV program. 35% of city dwellers liked it, and 22 rural dwellers liked it. At a 2.5% significance level, is opinion related to area of residence?
| Opinion | City (observed) | Rural (observed) | Total |
|---|---|---|---|
| Like | 21 | 22 | 43 |
| Dislike | 39 | 18 | 57 |
| Total | 60 | 40 | 100 |
| 20 22. |
Calculating expected frequencies:
- Like, City: (60×43)/100=25.8
- Like, Rural: (40×43)/100=17.2
- Dislike, City: (60×57)/100=34.2
- Dislike, Rural: (40×57)/100=22.8.
| Opinion | City (observed/expected) | Rural (observed/expected) |
|---|---|---|
| Like | 21 / (25.8) | 22 / (17.2) |
| Dislike | 39 / (34.2) | 18 / (22.8) |
| χ2=25.8(21−25.8)2+17.2(22−17.2)2+34.2(39−34.2)2+22.8(18−22.8)2 χ2=25.8(−4.8)2+17.2(4.8)2+34.2(4.8)2+22.8(−4.8)2 χ2=25.823.04+17.223.04+34.223.04+22.823.04 χ2≈0.893+1.340+0.674+1.011≈3.918 23. |
Degrees of freedom: df = (2 - 1)(2 - 1) = 1. Critical value for α=0.025 and df = 1 is approximately 5.024.
Since 3.918<5.024, we fail to reject H0 17 21.
The p-value for this test is 0.0478. This value is greater than the significance level of 0.025, further supporting the decision to fail to reject H0.
🔑 Important: The p-value represents the probability of observing a test statistic as extreme as, or more extreme than, the one calculated, assuming the null hypothesis is true 24.
🔑 Important: The Chi-squared test of independence requires that expected frequencies are at least 5 to ensure the validity of the test 16.
🔑 Important: The key for the Chi-squared test of independence is comparing the calculated test statistic to the critical value. If the test statistic is larger, H0 is rejected.
© 2026 Maeve. All rights reserved. This content is protected by copyright.