Exam 7 Study Guide
This guide covers chapters 13 and 14, the last two tools in the course. You will test categorical data against a claim and for association with chi-square, compare three or more means with one-way ANOVA, check the conditions and find which groups differ. Then you will describe two quantitative variables with a scatterplot and r, fit the least-squares line, read residuals and r², and predict honestly. Work one chapter at a time, try each worked example with the steps covered, and finish with the ten self-test items. The cram sheet at the end holds every formula.
What this guide covers
- Chapter 13 · chi-square goodness of fit and test of independence, expected counts and df, standardized residuals and Cramér's V, one-way ANOVA and the F ratio, conditions for both, and post-hoc comparisons with Tukey and Bonferroni.
- Chapter 14 · scatterplots, the correlation r and its limits, the least-squares line and its interpretation, residuals, r² and residual plots, the standard error of the estimate, and prediction without extrapolation.
Chapter 13Chi-Square and ANOVA
Read it in full: Chapter 13 in the textbook. Practice it in the lab: Test of Independence and Between and Within.
What to know
The goodness-of-fit test compares one categorical variable's observed counts with a claimed distribution. H0: the proportions are exactly as claimed; Ha: at least one differs. Expected counts are E = n × p; do not round them, and check they sum to n. The statistic χ² = Σ(O − E)² ÷ E is never negative, and only big values count against H0, so the test is always right-tailed. df = k − 1 (minus one more for each parameter estimated from the data).
In the book's meal-plan example (claimed 25/40/35, observed 40, 95, 65 of 200), χ² = 2.0000 + 2.8125 + 0.3571 = 5.17 with df = 2. The critical value at α = 0.05 is 5.991, p ≈ 0.075, so we fail to reject. That does not make the claim true. The biggest term, Silver at 2.81, shows where to look next.
The test of independence crosses two categorical variables in an r × c table. H0: no association; Ha: associated. Expected counts are E = (row total × column total) ÷ grand total, the counts you would see if every row had the same column profile. df = (r − 1)(c − 1). The book's exercise and sleep table gives χ² = 16.07 on 2 df, p ≈ 0.0003. Describe the pattern with standardized residuals (O − E) ÷ √E (beyond about ±2 marks a driving cell) and the size with Cramér's V = √[χ² ÷ (n × min(r − 1, c − 1))], here 0.23. Association is not causation.
Running many t-tests inflates the family-wise error rate: with three groups, 1 − 0.95³ ≈ 14%, and with five groups (ten tests) about 40%, as rough illustrations. One-way ANOVA tests H0: μ1 = μ2 = ... = μk against "at least one mean differs" (not "all differ") with one test and one α.
ANOVA compares two estimates of σ². MSW pools the scatter inside the groups (noise); MSB measures how far group means sit from the grand mean (signal plus noise). F = MSB ÷ MSW sits near 1 when the means are equal and grows when they are not, so the test is right-tailed. SSbetween = Σnj(x̄j − x̄)² on k − 1 df; SSwithin = ΣΣ(x − x̄j)² on N − k df; SStotal = SSbetween + SSwithin on N − 1 df, a built-in check. The book's three methods give F = 125.00 ÷ 11.50 = 10.87 on (2, 12), p ≈ 0.0020, and η² = 250 ÷ 388 = 0.64. With two groups, F = t² from the pooled t-test.
Chi-square needs counts (not percents), independent observations each in one cell, a random sample, and all expected counts at least 5 (Cochran allows up to 20% between 1 and 5, none below 1). If counts are too small, combine categories or use Fisher's exact test; paired categorical data need McNemar's test.
ANOVA needs independence within and between groups (the least forgiving), approximate normality within groups (robust with similar group sizes and decent n), equal variances (largest s under about twice the smallest, or largest variance under four times the smallest) and a quantitative response. Fixes: Welch's ANOVA for unequal variances, Kruskal-Wallis for strong non-normality in small groups, repeated-measures ANOVA when the same subjects are in every group.
A significant F says only that at least one mean differs. Post-hoc tests find which pairs while holding the family-wise error at α. Bonferroni tests each of m comparisons at α ÷ m. Tukey's HSD = q × √(MSW ÷ n) is the standard for all pairs with equal n. In the book, HSD = 3.77 × 1.517 = 5.72, so only A versus C (10 points apart) differs; A versus B and B versus C (5 apart) do not. If F is not significant, do not go fishing through the pairs.
- χ² = Σ(O − E)²/E; right-tailed; never negative.
- Goodness of fit: E = np, df = k − 1. Never round E.
- Independence: E = (row × column)/total, df = (r − 1)(c − 1).
- Chi-square needs counts and every expected count ≥ 5.
- F = MSB/MSW; df = k − 1 and N − k; SST = SSB + SSW.
- Ha for ANOVA: at least one mean differs, not all.
- Equal variances: largest s < 2 × smallest.
- Post-hoc: Tukey HSD = q√(MSW/n); Bonferroni tests at α/m.
Formulas and when to use them
| Quantity | Formula | When to use it |
|---|---|---|
| Chi-square statistic | χ² = Σ(O − E)² ÷ E | Both chi-square tests |
| Expected, goodness of fit | E = n × pi | One variable versus a claim |
| Expected, independence | E = (row total × column total) ÷ grand total | Two-way table |
| df | k − 1; (r − 1)(c − 1) | GOF; independence |
| Standardized residual | (O − E) ÷ √E | Which cells drive the result |
| Cramér's V | √[χ² ÷ (n × min(r − 1, c − 1))] | Size of an association, 0 to 1 |
| Between SS | Σ nj(x̄j − x̄)², df = k − 1 | ANOVA signal |
| Within SS | ΣΣ(x − x̄j)², df = N − k | ANOVA noise |
| F | MSB ÷ MSW, MS = SS ÷ df | Equal means? |
| Eta squared | η² = SSbetween ÷ SStotal | Share of variation explained |
| Tukey HSD | qα, k, N−k × √(MSW ÷ n) | All pairs, equal n |
| Bonferroni | Each test at α ÷ m | A few planned comparisons |
Critical values at α = 0.05
| Distribution | df | Critical value |
|---|---|---|
| χ² | 1, 2, 3, 4, 5 | 3.841, 5.991, 7.815, 9.488, 11.070 |
| χ² | 6 | 12.592 |
| F | (2, 12) | 3.89 |
| F | (2, 20) and (3, 20) | 3.49 and 3.10 |
| F | (3, 30) and (4, 30) | 2.92 and 2.69 |
| Studentized range q | k = 3, df = 12 | 3.77 |
Worked examples
Worked example 1 · goodness of fit for a die
A die is rolled 120 times: faces 1 to 6 come up 15, 22, 18, 26, 17, 22 times. Is it fair? Use α = 0.05.
Step 1 · hypotheses and EH0: each face has probability 1/6. E = 120 × 1/6 = 20 for every face, summing to 120. All E ≥ 5.
Step 2 · terms(15 − 20)²/20 = 1.25; (22 − 20)²/20 = 0.20; (18 − 20)²/20 = 0.20; (26 − 20)²/20 = 1.80; (17 − 20)²/20 = 0.45; (22 − 20)²/20 = 0.20.
Step 3 · χ²Sum = 4.10, df = 6 − 1 = 5.
Step 4 · decideCritical value 11.070; p ≈ 0.535. 4.10 < 11.070, so fail to reject.
Step 5 · say itThese rolls give no convincing evidence that the die is unfair. That is not proof of fairness; 120 rolls cannot detect a small bias. Face 4, with the largest term, is the one to watch.
Worked example 2 · a test of independence with residuals and V
240 commuters are classified by age (under 35: car 40, transit 35, active 25; 35 and over: car 90, transit 30, active 20). Test for association at α = 0.05.
Step 1 · marginsRows 100 and 140; columns 130, 65, 45; total 240.
Step 2 · expectedUnder 35: 54.17, 27.08, 18.75. 35 and over: 75.83, 37.92, 26.25. All at least 5.
Step 3 · χ²3.705 + 2.314 + 2.083 + 2.647 + 1.653 + 1.488 = 13.89, df = (2 − 1)(3 − 1) = 2.
Step 4 · decide13.89 > 5.991; p ≈ 0.0010. Reject H0: commute mode and age group are associated.
Step 5 · describeStandardized residuals, under 35: −1.92, 1.52, 1.44; 35 and over: 1.63, −1.29, −1.22. The car cells have the largest residuals, though none passes ±2: younger commuters drive less than independence predicts and older ones more, with the transit and active cells reversed.
Step 6 · sizeV = √(13.89 ÷ (240 × 1)) = 0.24, a modest association. These are survey data, so no causal claim.
Worked example 3 · a one-way ANOVA by hand
Three study apps, four students each: A 10, 12, 11, 13; B 14, 15, 13, 16; C 12, 13, 14, 13. Test for a difference in means at α = 0.05.
Step 1 · meansx̄A = 11.5, x̄B = 14.5, x̄C = 13.0; grand mean 13.00.
Step 2 · between4(−1.50)² + 4(1.50)² + 4(0.00)² = 18.00, df = 2.
Step 3 · within5 + 5 + 2 = 12, df = 12 − 3 = 9. Check: SStotal = 30.00 = 18.00 + 12.
Step 4 · FMSB = 18.00 ÷ 2 = 9.00; MSW = 12 ÷ 9 = 1.333; F = 6.75.
Step 5 · decideCritical F(2, 9) = 4.26; p ≈ 0.0162. Reject H0: at least one mean differs. η² = 18.00 ÷ 30.00 = 0.60.
Step 6 · check variancesGroup SDs 1.29, 1.29, 0.82: largest ÷ smallest = 1.58, under 2.
Worked example 4 · which pairs differ? Tukey and Bonferroni
Continue the study-app ANOVA. Find which pairs of means differ.
Step 1 · HSDq (α = 0.05, k = 3, df = 9) = 3.95. √(MSW ÷ n) = √(1.333 ÷ 4) = 0.577. HSD = 2.28.
Step 2 · pairsA vs B: 3.0; A vs C: 1.5; B vs C: 1.5.
Step 3 · compareA vs B: significant; A vs C: not significant; B vs C: not significant.
Step 4 · Bonferroni checkSE of a difference = √[1.333(1/4 + 1/4)] = 0.816. A vs B: t = 3.67. Critical t at 0.05/3 two-tailed, df = 9: 2.93. Same verdict for A vs B.
Read itThe overall F was significant, but only A versus B separates. A significant F never means every pair differs.
- Feeding percentages into χ². Chi-square needs raw counts.
- Rounding expected counts. Keep E = 47.95 as 47.95.
- Checking observed counts for the 5 rule. The rule is about expected counts; an observed 0 is fine.
- Reading a significant χ² as cause. Survey tables show association only.
- Running pairwise t-tests instead of ANOVA. Each extra test adds false-alarm risk.
- Writing Ha as "all means differ." It is "at least one differs."
- Pooling very unequal variances. If the largest s is over twice the smallest, use Welch's ANOVA.
- Fishing after a non-significant F. Post-hoc tests follow a significant F, or planned contrasts set in advance.
Chapter 13 self-test · ten items
- 50, 30, 20
- 50, 50, 50
- 100, 60, 40
- 75, 45, 30
- 1.00
- 0.20
- 5.00
- 25.00
- 5
- 4
- 6
- 25
- 24
- 140
- 40
- 30
- 12
- 7
- 11
- 6
- 0.030
- 0.122
- 0.173
- 0.300
- It always gives a larger F than a t-test
- It does not need any conditions at all
- It keeps the overall false-alarm rate at α
- It shows directly which pair of means differs
- 3.00
- 0.38
- 2.62
- 30.00
- It passes, since all SDs are positive
- It fails, since 9.6 is over twice 4.0
- It passes, since the mean SD is 6.4
- It cannot be checked without n
- All three pairs differ
- Only 50 vs 54 differs
- None of the pairs differ
- 50 vs 61 and 54 vs 61
Chapter 14Correlation and Regression
Read it in full: Chapter 14 in the textbook. Practice it in the lab: Read a Scatterplot and Fit the Least-Squares Line.
What to know
A scatterplot shows two quantitative variables measured on the same individuals, one dot per individual. The explanatory variable x goes on the horizontal axis and the response y on the vertical. Describe it in order: form (linear, curved, clusters), direction (positive or negative), strength (how tightly points hug the form) and outliers (points off the joint pattern). Strength is not steepness: a shallow, tight band is strong.
The correlation r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² × Σ(y − ȳ)²], or the average product of z-scores, Σzxzy ÷ (n − 1). It lies between −1 and +1, has no units, is unchanged by rescaling and is symmetric in x and y. For the book's six students (hours 2 to 10, scores 72 to 94), r = 126 ÷ √(42 × 466) = 0.90. Strength is distance from zero, so −0.87 is stronger than +0.60.
Four cautions: r measures linear association only (r near 0 can hide a strong curve); r is not resistant (Anscombe's quartet shares one r and one line across four very different pictures); a restricted range shrinks r; and correlation is not causation, since a lurking variable can produce any r. Only a randomized experiment licenses a causal claim.
The least-squares line ŷ = a + bx minimizes Σ(y − ŷ)², the sum of squared vertical distances. b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² = r(sy ÷ sx) and a = ȳ − bx̄, so the line always passes through (x̄, ȳ) and the slope shares the sign of r. For the students, b = 126 ÷ 42 = 3 and a = 78 − 18 = 60: ŷ = 60 + 3x. Any other slope through (6, 78) gives a bigger SSE (98.5 for slopes 2.5 and 3.5 versus 88). Regression is not symmetric: predicting x from y needs its own line.
Interpret the slope as a predicted average rate: "for each additional hour, the model predicts about 3 more points, on average," not a causal promise. The intercept is the prediction at x = 0, meaningful only if x = 0 lies within the data; here hours ran from 2 to 10, so 60 just anchors the line.
A residual is y − ŷ; least-squares residuals always sum to 0. SST = Σ(y − ȳ)² = 466 and SSE = Σ(y − ŷ)² = 88, so r² = 1 − SSE ÷ SST = 0.81: about 81% of the variation in scores is explained by the linear relationship with hours. It is not 81% of points on the line, not 81% accuracy and not 81% caused. r² hides direction, so report r too.
A residual plot (residuals against x or ŷ) should be a formless horizontal band. A U or arch means curvature; a fan means non-constant spread; a lone stray point is an outlier. Leverage is extremeness in x; a point is influential if removing it noticeably moves the slope, intercept or r. A high r² does not prove the model is right.
The line predicts the average y at a given x. The standard error of the estimate se = √[SSE ÷ (n − 2)] = √22 = 4.69 is the typical miss (two df are spent on slope and intercept). Interpolation within the x range is supported; extrapolation is not: the line predicts an impossible 105 at 15 hours. Because |r| < 1, predictions regress toward ȳ. Inference on the slope assumes linearity, independence, constant variance and roughly normal residuals; a p-value is not the probability the slope is zero, and a 95% CI describes the procedure.
- Form, direction, strength, outliers; x is explanatory.
- r lies in [−1, 1], has no units and measures linear association only.
- b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² = r sy/sx; a = ȳ − bx̄.
- The line passes through (x̄, ȳ); residuals sum to 0.
- r² = 1 − SSE/SST = share of variation in y explained by the line.
- se = √[SSE ÷ (n − 2)].
- Interpolate, do not extrapolate. Refit to predict x from y.
- Correlation is not causation; strength is not steepness.
Formulas and when to use them
| Quantity | Formula | When to use it |
|---|---|---|
| Correlation | r = Sxy ÷ √(Sxx × Syy) | Strength and direction of a linear pattern |
| Correlation (z form) | r = Σzxzy ÷ (n − 1) | Why r has no units |
| Slope | b = Sxy ÷ Sxx = r(sy ÷ sx) | Predicted change in y per unit x |
| Intercept | a = ȳ − bx̄ | Anchors the line |
| Prediction | ŷ = a + bx | Average y at x, inside the data range |
| Residual | e = y − ŷ | What the line missed |
| Sums of squares | SST = Σ(y − ȳ)²; SSE = Σ(y − ŷ)² | Variation before and after the line |
| r² | 1 − SSE ÷ SST = r² | Share of variation explained |
| Std. error of estimate | se = √[SSE ÷ (n − 2)] | Typical miss |
Reading a residual plot
| What you see | What it means | What to do |
|---|---|---|
| Formless band around 0 | A line fits | Report slope, r and r² |
| U or arch | Curved form | Transform or fit a curve |
| Fan widening | Spread grows with x | Predictions weaker at the wide end |
| One point far off vertically | Outlier in y | Investigate; report with and without |
| One point far out in x | High leverage, maybe influential | Refit without it and compare |
Worked examples
Worked example 1 · computing r from a deviation table
Six weeks of ad spend x (hundreds of dollars) and sales y (thousands): x = 3, 5, 6, 8, 9, 11; y = 20, 25, 24, 31, 33, 37. Find r.
Step 1 · meansx̄ = 42 ÷ 6 = 7.00; ȳ = 170 ÷ 6 = 28.33.
Step 2 · deviationsx − x̄: −4.00, −2.00, −1.00, 1.00, 2.00, 4.00. y − ȳ: −8.33, −3.33, −4.33, 2.67, 4.67, 8.67. Both sum to 0.
Step 3 · sumsSxy = Σ(x − x̄)(y − ȳ) = 91.00; Sxx = 42.00; Syy = 203.33.
Step 4 · rr = 91.00 ÷ √(42.00 × 203.33) = 91.00 ÷ 92.41 = 0.985.
Step 5 · read itStrong and positive, and only after the scatterplot shows a straight band. These are observational weeks, so r says nothing about whether ads caused the sales.
Worked example 2 · fitting and interpreting the line
Fit the least-squares line for the ad data and interpret it.
Step 1 · slopeb = Sxy ÷ Sxx = 91.00 ÷ 42.00 = 2.1667. Check: r(sy ÷ sx) = 0.9847 × (6.3770 ÷ 2.8983) = 2.1667.
Step 2 · intercepta = 28.33 − 2.1667(7.00) = 13.167.
Step 3 · the lineŷ = 13.17 + 2.167x. At x̄ = 7.00, ŷ = 28.33 = ȳ.
Step 4 · slope in wordsEach extra $100 of ad spend goes with about 2.17 thousand dollars more in predicted sales, on average.
Step 5 · intercept in wordsx = 0 is outside the observed 3 to 11, so 13.17 only anchors the line; it is not a forecast for zero spending.
Worked example 3 · residuals, r² and the standard error of the estimate
Find the residuals, SSE, r² and se for the ad data.
Step 1 · predictions19.67, 24.00, 26.17, 30.50, 32.67, 37.00.
Step 2 · residuals0.33, 1.00, −2.17, 0.50, 0.33, 0.00. They sum to 0.00.
Step 3 · SSEΣ residual² = 6.167; SST = Syy = 203.33.
Step 4 · r²1 − 6.167 ÷ 203.33 = 0.970, matching r² = 0.985² = 0.970. About 97% of the week-to-week variation in sales is explained by the linear relationship with ad spend.
Step 5 · se√(6.167 ÷ 4) = 1.24 thousand dollars: a typical week sits about that far from the line.
Worked example 4 · predicting, and where not to
Use the ad line to predict sales at x = 7 and x = 20, and explain the difference. Then predict hours studied from a score of 90 in the book's student data.
Step 1 · interpolateŷ = 13.17 + 2.167(7) = 28.33, inside the observed 3 to 11; give or take about 2se = 2.5.
Step 2 · extrapolateŷ = 13.17 + 2.167(20) = 56.50. x = 20 is far beyond the data; the line cannot know whether sales level off, so this number is not supported.
Step 3 · reverse predictionInverting ŷ = 60 + 3x gives (90 − 60) ÷ 3 = 10 hours, but that is the wrong line. Refit with hours as the response: slope = 126 ÷ 466 = 0.270, intercept = 6 − 0.270(78) = −15.09, so predicted hours = 9.24.
Why they differEach regression pulls its predictions toward the mean of its own response. With |r| < 1, the two lines are not inverses.
- Computing r before looking. r is blind to curves, clusters and single influential points.
- Treating strength as steepness. A shallow tight band is strong; a steep fuzzy one is weak.
- Calling −0.87 weaker than +0.60. Strength is distance from zero.
- Reading the slope as cause. Say "predicted, on average" for observational data.
- Interpreting an intercept outside the data. If x = 0 was never observed, the intercept only anchors the line.
- Saying r² is the share of points on the line. It is the share of variation in y explained.
- Extrapolating. The line predicted an impossible 105 at 15 hours.
- Inverting the line to predict x. Refit with the roles reversed.
Chapter 14 self-test · ten items
- The response variable
- The one with larger values
- The explanatory variable
- Either, it never matters
- +0.85
- +0.10
- −0.40
- −0.92
- 0.849
- 3.000
- 0.240
- 0.012
- ŷ = 40 + 3x
- ŷ = 25 + 3x
- ŷ = 5 + 3x
- ŷ = 25 + 0.33x
- 1.5
- 0.24
- 6.0
- 2.4
- 3
- −3
- 24
- 9
- 0.75
- 0.25
- 4.00
- 0.50
- 64% of the points lie exactly on the line
- Predictions from the line are 64% accurate
- x causes 64% of the changes in y
- 64% of the variation in y is explained by the line
- The straight line fits the data well
- The true form is curved, so a line is a poor model
- The spread of the residuals is constant
- There are no outliers in the data
- x = 40
- x = 25
- x = 58
- x = 85
One pageCram sheet
Everything from chapters 13 and 14 in one place. Cover the right column and see if you can rebuild each row.
Formulas
| Name | Formula | Note |
|---|---|---|
| Chi-square | Σ(O − E)²/E | Right-tailed |
| Expected counts | np; row × column ÷ total | All ≥ 5; never round |
| df | k − 1; (r − 1)(c − 1) | GOF; independence |
| Cramér's V | √[χ²/(n × min(r − 1, c − 1))] | Size of association |
| ANOVA | F = MSB/MSW; df k − 1, N − k | SST = SSB + SSW |
| Effect size | η² = SSB/SST | Share explained |
| Tukey | HSD = q√(MSW/n) | Bonferroni: α/m |
| Correlation | r = Sxy/√(Sxx Syy) | [−1, 1], unit-free |
| Line | b = Sxy/Sxx = r sy/sx; a = ȳ − bx̄ | Through (x̄, ȳ) |
| Fit | r² = 1 − SSE/SST; se = √[SSE/(n − 2)] | Residuals sum to 0 |
Rules that are not formulas
| Topic | The rule |
|---|---|
| Chi-square data | Counts only; paired yes/no uses McNemar. |
| Small counts | Combine categories or use Fisher's exact test. |
| ANOVA Ha | At least one mean differs. |
| ANOVA conditions | Independence, rough normality, largest s < 2 × smallest. |
| After F | Post-hoc only after a significant F (or planned contrasts). |
| Scatterplot | Form, direction, strength, outliers. |
| r limits | Linear only, not resistant, shrinks with restricted range, not causal. |
| Residual plot | Want no pattern; U = curve; fan = changing spread. |
| Prediction | Interpolate only; refit to predict x from y. |