
Lab: Forecasting Elections · Part 3 of 3
Lab · Module 12 · Wed Nov 18
Welcome to the Module 12 lab
Today is Day 3 of a three-lab analysis — the closing lab of the Bread + Peace arc. This page is still a coaching guide, and the sparsest of the three. The Targets and their example links should be enough to write most of the code; most links go to the M12 pre-study, whose activities build the same plots on the REACH data, and each activity’s 👀 Spoiler tab shows its finished code. Where a plot or a tool is new, the code is given. As in the last two labs, there’s nothing to write up in the session; the debrief is where we talk through what the diagnostics show. After the lab you’ll write the one piece of writing in the three labs: a short, informal reflection (Step 11).
Today’s questions · how far can we trust the model?
Last week you fit the full Bread + Peace MLR (bp_mod2: vote ~ growth + fatalities) and re-forecast 2020 + 2024. The MLR pulled the two big M10 misses (1952, 1968) back toward the line, but its 2020 forecast missed by even more than the bread SLR’s did. Every CI, p-value, and forecast interval you’ve drawn from it leans on assumptions about the model’s errors, so careful analysts check those before trusting the results. Today you’ll ask three questions of bp_mod2:
- The assumptions. Do the model’s residuals look the way it assumes (no consistent bend, an even spread, a roughly Normal shape), or does something stand out?
- The influence. Which elections is the model leaning on hardest, and does its peace half still hold up without them?
- The final forecast. After the diagnostics, what is the final 2020 + 2024 forecast, and how far should we trust it?
bread_peace · 17 elections · 1952–2016 · Hibbs (2000); Thomas (2020)
Same 17-row dataset you’ve used for two weeks now. One row per presidential election. Full codebook at Course Datasets · bread_peace.
- year integer — election year
- vote numeric — incumbent party’s share of the two-party popular vote (%)
- growth numeric — weighted-average annualized growth of per-capita real disposable income over the term (%)
- fatalities numeric — cumulative U.S. military fatalities per million population over the term
- wars character — major conflict(s) contributing to the term’s fatalities
What you’ll leave with
- The diagnostic plots for bp_mod2: residual–fitted, a component-plus-residual plot for each predictor, scale–location, and Q–Q, plus the multicollinearity check
- The one-call check_model() all-in-one view, which you can now read with understanding
- A Cook’s-distance investigation, with two with-and-without refits, that tests last week’s prediction about which elections the model leans on hardest
- The final 2020 + 2024 forecast
- After the lab, a short reflection on what you did and learned across the three labs
Where today fits in the three-lab arc
| Lab | What you’ll add to bread_peace_analysis.qmd |
|---|---|
| M10 lab | Steps 0–4: setup, EDA, the bread and peace SLRs, and a 2020 + 2024 forecast |
| M11 lab | Steps 5–7: the bread SLR’s biggest misses, the Bread + Peace MLR, and the MLR re-forecast |
| M12 lab · today | Steps 8–10: the diagnostic toolkit, influence and Cook’s distance, and the final forecast. After the lab: Step 11, the reflection |
How the time works
In the session, work through Before you begin and Steps 8–10 in order, then we’ll stop for the debrief. After the lab, by 11:59 PM on the Tuesday after it, write the Step 11 reflection, then render, push, and submit the rendered HTML on Canvas.
Before you begin · re-open your cumulative notebook
Open
PSY652_project/programs/bread_peace_analysis.qmd— the same notebook you’ve extended across M10 and M11.Activate the M12 lab sections. In your notebook’s section outline, find the comment block that begins
<!-- Activate these in the M12 lab:and move the four Step lines inside it out of the comment, then delete the now-empty comment lines. As before, each step’s chunks go directly under its own header, before the next one, with an empty line above each# Stepheader that follows a chunk. Your full outline should now read:# Step 0 · Setup # Step 1 · EDA # Step 2 · SLR · vote ~ growth # Step 3 · SLR · vote ~ fatalities # Step 4 · Forecasting 2020 + 2024 with the bread SLR # Step 5 · From SLR to MLR · the bread SLR's biggest misses # Step 6 · MLR · vote ~ growth + fatalities · the Bread + Peace model # Step 7 · Re-forecast 2020 + 2024 with the MLR # Step 8 · The diagnostic toolkit # Step 9 · Influence and Cook's distance # Step 10 · The final forecast # Step 11 · Reflection · what you did and learnedCheck the setup chunk in Step 0: it should already load performance, one of the M10 lab’s Target packages (today’s check_collinearity() and check_model() come from it). If
library(performance)isn’t there, add it.Then, once, in the Console (not in your notebook), install the package check_model() uses to draw its panels:
install.packages("see")Without see, check_model() can’t draw its panels, and your notebook won’t render once you add that call. Like every install, this line belongs in the Console: in your notebook it would reinstall the package every time you render.
Render once now. If your existing notebook renders cleanly today, you’re ready to add M12 content. Fix any breakage before adding new content.
Put last week’s objects back in your Environment. Choose Run → Run All in RStudio (Ctrl+Alt+R; Cmd+Option+R on a Mac) so every chunk from Steps 0–7 runs in your own session. Today you need bp_mod2 (Step 6), the anchor model for the day, plus three forecast objects that Step 10 prints side by side: new_ci_m2 and new_pi_m2 (Step 7), and new_elections_pi (Step 4).
Step 8 · The diagnostic toolkit
In your notebook — this step’s chunks go under # Step 8 · The diagnostic toolkit.
How you interpret bp_mod2 — and especially its standard errors, p-values, confidence intervals, and prediction intervals — depends on assumptions about how the model’s errors behave. If they’re badly violated, those quantities can be miscalibrated, sometimes silently. Part 1 of the M12 Module lays them out; today you’ll check four of them on bp_mod2, plus the practical multicollinearity check. The diagnostics aren’t pass/fail tests (the Module’s note on what diagnostics are explains why): each calls for a judgment, which we’ll make together in the debrief.
| # | Assumption | What it says | How we check it today |
|---|---|---|---|
| 1 | Linearity | The relationship between each predictor and the outcome is linear (holding the others constant) | Residual–fitted plot, then a component-plus-residual plot for each predictor |
| 2 | Additivity | Each predictor’s slope is the same across values of the other predictors | Assumed in the main lab; the Going further box at the end of this step shows how to check it with an interaction term |
| 3 | Independence | The errors are independent of each other — one observation’s miss tells you nothing about another’s | Substantive judgment from the study design |
| 4 | Equal variance (homoscedasticity) | The error variance is constant across the range of fitted values | Scale–location plot |
| 5 | Normality of errors | The errors are approximately Normal | Q–Q plot (no formal test needed) |
| — | No severe multicollinearity (a practical concern, not a formal assumption) | Predictors aren’t so correlated that the model can’t attribute variance between them | Variance Inflation Factor (VIF) |
Targets
- Build an augmented data frame for bp_mod2 with
bp_mod2 |> augment(data = bread_peace), the same step you took in both earlier labs. Call it bp_aug, and mutate() one derived column onto it for the scale–location plot:sqrt_abs_std_resid = sqrt(abs(.std.resid)). Everything else the plots need (.fitted, .resid, .std.resid, .hat, .cooksd) augment() already provides (the M12 pre-study’s lookup table says what each one is and how it’s computed), and this one object powers every hand-built plot in Steps 8 and 9. M12 pre-study · Activity 1.1 - Build the residual–fitted plot yourself. Start from the M12 pre-study’s residual–fitted code: swap in bp_aug, replace its geom_jitter() line (tuned for thousands of points) with geom_point(), add
geom_text_repel(aes(label = year)), as in your M10 scatters, so you can tell which election is which, and update the axis labels and title for this model. This is the one figure today whose alt text you write yourself: give the chunk a#| fig-alt:line describing the axes, the points, and the smoother (the M10 lab’s Why every figure gets alt text box has the how and why). M12 pre-study · Activity 1.1 - Add a component-plus-residual plot for each predictor (code given below, alt text included). M12 Module · Which predictors need a linearity check?
- Add the scale–location and Q–Q plots (code given below, alt text included). M12 pre-study · Activities 2.1 and 2.2
- Run the VIF check (one line, given below). M12 pre-study · Activity 3.3
- Run check_model(), the all-in-one view (code given below). M12 Module · The one-stop diagnostic
Assumption 1 · Linearity · the residual–fitted plot
Plot the model’s fitted values on the x-axis against its residuals on the y-axis, and overlay a LOESS smoother (geom_smooth() with method = "loess"), a flexible curve that tracks the local average of the residuals. If linearity holds, the smoother stays near zero across the range of fitted values without a consistent bend. With only 17 elections, expect wiggles that follow one or two elections; a problem would be a curve that the bulk of the points follow. Yours should look like the page’s version below, which adds colors:
The Module’s table for reading the residual–fitted plot shows what a real violation looks like.
Assumption 1 · Linearity · one plot per predictor
The residual–fitted plot checks the model as a whole. Both of bp_mod2’s predictors are numeric, so each one also gets its own check: a component-plus-residual plot. For each election, it takes the predictor’s part of the prediction (the predictor’s slope times its value), adds the residual back, and plots the sum against the predictor itself. The dashed line is the model’s straight line for that predictor. Read the smoother the way you read the residual–fitted plot: a problem would be a curve away from the dashed line that most elections follow. The code is given, alt text included. Copy the three chunks below under your Step 8 header:
# Each predictor's slope in bp_mod2
slope_growth <- bp_mod2 |>
tidy() |>
filter(term == "growth") |>
pull(estimate)
slope_fatalities <- bp_mod2 |>
tidy() |>
filter(term == "fatalities") |>
pull(estimate)
bp_cr <- bp_aug |>
mutate(
growth_part = slope_growth * growth, # growth's part of the prediction
growth_cr = growth_part + .resid, # plus what the model missed
fatalities_part = slope_fatalities * fatalities, # fatalities' part of the prediction
fatalities_cr = fatalities_part + .resid # plus what the model missed
)#| fig-alt: "Component-plus-residual plot for growth in bp_mod2: income growth on the x-axis against growth's part of the prediction plus the residual on the y-axis, elections labeled by year, with the model's straight line dashed and a LOESS smoother."
bp_cr |>
ggplot(aes(x = growth, y = growth_cr)) +
geom_line(aes(y = growth_part), linetype = "dashed") + # the model's straight line
geom_point() +
geom_smooth(method = "loess", se = FALSE, formula = y ~ x) +
geom_text_repel(aes(label = year)) +
labs(
x = "Income growth (%)",
y = "Component + residual",
title = "Component-plus-residual plot · growth"
)#| fig-alt: "Component-plus-residual plot for fatalities in bp_mod2: military fatalities per million on the x-axis against fatalities' part of the prediction plus the residual on the y-axis, elections labeled by year, with the model's straight line dashed and no smoother."
bp_cr |>
ggplot(aes(x = fatalities, y = fatalities_cr)) +
geom_line(aes(y = fatalities_part), linetype = "dashed") + # the model's straight line
geom_point() +
geom_text_repel(aes(label = year)) +
labs(
x = "Military fatalities per million",
y = "Component + residual",
title = "Component-plus-residual plot · fatalities"
)The fatalities plot has no smoother on purpose. 9 of the 17 elections had no military fatalities, and all but two fall between 0 and 9.4 deaths per million; 1968 (174.3) and 1952 (205.6) sit far to the right, with no elections in between. A smoother would draw a curve across that empty gap, where there are no elections to follow.
Yours should look like the page’s versions below, which add colors:


Assumption 2 · Additivity
Assumed in the main lab: bp_mod2 gives growth one slope for every election. The Going further box at the end of this step shows how to check it.
Assumption 3 · Independence · the study-design check
This one isn’t a plot: it’s a judgment about the study design. Are the 17 elections independent of each other? Strictly speaking, probably not: presidential elections are a time series, and each inherits its incumbent party, partisan coalitions, and economic context from the one before it. When neighboring elections’ misses run in the same direction (positive serial dependence), conventional OLS standard errors can become misleading, often too small, which makes CIs and p-values too optimistic. (A rough check: under bp_mod2, the correlation between consecutive elections’ residuals is r = -.04, no sign of that pattern, though 17 elections give the check little power.) For this course, we acknowledge the dependence and proceed, reading the inferences as approximate.
Three common strategies:
- Acknowledge and proceed. Treat the inferences as approximate, as this lab does.
- Robust standard errors. Compute heteroscedasticity-and-autocorrelation-consistent (HAC) SEs using sandwich::vcovHAC() and report those instead of the OLS defaults. The point estimates don’t change; the SEs (and CIs / p-values) account for the dependence — though with N = 17 the HAC estimates are themselves rough.
- Use a time-series model. Fit a model whose errors are allowed to carry over from one election to the next: an AR(1) error structure, for example, in which each election’s error is partly a carry-over of the previous election’s.
Assumption 4 · Equal variance (homoscedasticity) · the scale–location plot
The scale–location plot puts \(\sqrt{|\text{standardized residual}|}\) on the y-axis against the fitted values on the x-axis. If residual variance is constant, it looks like a flat horizontal band; a funnel that steadily widens or narrows signals unequal variance. The code follows the residual–fitted pattern with a new y-variable, so it’s given, alt text included. Copy it into a chunk under your Step 8 header:
#| fig-alt: "Scale–location plot for bp_mod2: the square root of each election's absolute standardized residual on the y-axis against its fitted vote share on the x-axis, elections labeled by year, with a LOESS smoother."
bp_aug |>
ggplot(aes(x = .fitted, y = sqrt_abs_std_resid)) +
geom_point() +
geom_smooth(method = "loess", se = FALSE, formula = y ~ x) +
geom_text_repel(aes(label = year)) +
labs(
x = "Fitted value (predicted vote share)",
y = "Square root of |standardized residual|",
title = "Scale–location plot · bp_mod2"
)
Assumption 5 · Normality of errors · Q–Q plot
The Q–Q plot lines up the residuals against the quantiles of a standard Normal distribution: if the points fall along the reference line, the residuals are approximately Normal. In ggplot2 the pair of layers is stat_qq() + stat_qq_line(), and the one unguessable wrinkle is the aesthetic: a Q–Q plot maps aes(sample = .std.resid) — sample, not x — because both axes are computed from that one column. The code is given, alt text included; copy it into your Step 8 section:
#| fig-alt: "Normal Q–Q plot of bp_mod2's standardized residuals against theoretical Normal quantiles, with a reference line; points on the line are consistent with Normal errors."
bp_aug |>
ggplot(aes(sample = .std.resid)) +
stat_qq() + # the points: each residual against its Normal quantile
stat_qq_line() + # the reference line
labs(
x = "Theoretical Normal quantile",
y = "Standardized residual quantile",
title = "Normal Q–Q plot · bp_mod2"
)
Why no formal normality test? You’ll often see a Shapiro–Wilk test reported beside a Q–Q plot. The M12 Module explains why Regression and Other Stories doesn’t recommend one, and when normality actually matters; with 17 elections, a formal test would also have little power to detect a departure. The same small n makes the Q–Q plot itself noisy: even with truly Normal errors, one point as far below the line as 2000’s is not especially unusual, so 2000’s point flags an election worth a closer look more than it establishes a heavier lower tail.
Practical check · no severe multicollinearity · VIF
The Variance Inflation Factor measures how much each coefficient’s variance is inflated by that predictor’s overlap with the others: a VIF of 1 means no overlap, and a VIF above 5 or 10 conventionally triggers a warning (the Module’s VIF section gives the scale). growth and fatalities correlate at only r = .22, so make a quick guess: near 1, or near 5? Then run the check:
bp_mod2 |> performance::check_collinearity()The output also reports a 95% CI around each VIF. Read the VIF itself. (Older versions of performance computed that interval in a way that could show an enormous upper end for a VIF near 1; if yours does, that’s the reason, and the VIF column is still the number to read.)
The all-in-one view · performance::check_model()
You’ve now built each diagnostic by hand, which is the surest way to know what the panels mean. performance::check_model() draws three of your plots (residual–fitted, scale–location, and Q–Q) and the VIFs, plus two more panels, as a single six-panel view in one call. (Independence, additivity, and the per-predictor plots aren’t among them.) This is the one diagnostic the pre-study left for lab, because it needs a full-size plot pane and the see package, neither of which a browser sandbox provides. Add it under # Step 8, in a chunk with room for six panels:
#| fig-width: 10
#| fig-height: 9
#| fig-alt: "The six check_model() panels for bp_mod2: posterior predictive check, linearity, homogeneity of variance, influential observations, collinearity, and normality of residuals."
bp_mod2 |> performance::check_model()The two size lines matter: at Quarto’s default figure size, the six panels are squeezed too small to read. If the Console suggests installing qqplotr too, you can skip it. (Installing it adds a confidence band to the normality panel and switches its reference line to the same quartile line stat_qq_line() draws.)
Reading the six panels
- Posterior predictive check (the one you read in the pre-study’s wrap-up). The model simulates many outcome datasets, and the panel overlays their distributions on the real outcome’s; if the real one looks like the simulated ones, the model reproduces the outcome’s overall shape.
- Linearity and Homogeneity of Variance. The same smoothers you built by hand, now with gray 95% confidence bands.
- Influential Observations (Step 9’s question, asked another way). The dashed contour lines mark check_model()’s own Cook’s-distance cutoff: about 0.83 for this model, roughly 3.5 times the 4/n screen of 0.235 you’ll use in Step 9. A few points carry labels: row numbers, in election order (row 1 is 1952, row 13 is 2000).
- Collinearity. Each dot is a VIF, the same numbers as your check_collinearity() output; both sit at about 1.
- Normality of Residuals. This version is detrended: it plots each point’s distance from a reference diagonal, so the line is flat instead of diagonal. Two things differ from your hand-built plot. Each residual is rescaled using a \(\hat{\sigma}\) estimated with that election left out (a studentized residual), which pushes an unusual election farther out. And unless qqplotr is installed, the reference diagonal runs through zero with a slope equal to the residuals’ SD, not through the quartiles. So expect 2000 to sit farther from the line here than on your plot.
Additivity says each predictor’s slope is the same regardless of the values of the other predictors. Era isn’t in bp_mod2 yet, but adding it lets you ask one concrete version of the question: did voters reward income growth the same way before and after 1990? (One reason it might differ: if polarization has grown, fewer voters may switch parties over the economy.) Checking it takes an interaction term, which lets the growth slope differ by era. Interactions (moderation) are a PSY 653 topic, so this box is a preview; the M12 Module’s Visualizing the additivity assumption section shows the idea on the REACH data.
1 · Build the era as a factor. case_when() assigns each election to an era, and factor() fixes the order of the two levels, so pre-1990 is the reference group. There is no 1990 election, so the break falls between 1988 and 1992. (The 1990 split is an instructor-specified contrast, not a breakpoint chosen by searching the data for the biggest difference.) M04 Module · Recoding values · M10 Module · Store categorical predictors as factors
bp_era <- bread_peace |>
mutate(era = case_when(
year <= 1988 ~ "pre-1990",
year >= 1992 ~ "post-1990"
) |> factor(levels = c("pre-1990", "post-1990")))
bp_era |> count(era) # 10 pre-1990, 7 post-1990, no NA2 · Look first. Color the points by era and draw one least-squares line per era:
#| fig-alt: "Scatterplot of incumbent vote share against income growth, points and least-squares lines colored by era (pre-1990 and post-1990)."
bp_era |>
ggplot(aes(x = growth, y = vote, color = era)) +
geom_point() +
geom_smooth(method = "lm", formula = y ~ x, se = FALSE)
The pre-1990 line is steeper. (These lines are two separate SLRs that ignore fatalities, so their slopes, 3.36 and 1.64, differ a little from the model’s below.)
3 · Fit the interaction model. In a formula, growth * era means growth, era, and their product; the product term lets the growth slope differ by era. fatalities stays in, as in bp_mod2:
bp_era_int <- lm(vote ~ growth * era + fatalities, data = bp_era)
bp_era_int |> tidy(conf.int = TRUE)4 · Read it. The row to read is growth:erapost-1990: the difference between the two eras’ growth slopes (post-1990 minus pre-1990), holding fatalities constant. Here b = -2.33, 95% CI [-5.08, 0.43], p = .091. The growth row is now the pre-1990 slope (3.84 points of vote share per point of growth), and adding the interaction gives the post-1990 slope: 3.84 + (-2.33) = 1.51.
Interpretation. The point estimate says growth went with a smaller vote gain after 1990, as the polarization idea would predict. But the 95% CI runs from a post-1990 slope near zero, or even negative, to a slightly steeper one, so these 17 elections (only 7 after 1990) can’t tell whether the two slopes really differ. The check neither confirms nor rules out additivity; it stays an assumption to report, now with a reason to wonder about it. (One more reading note: with the interaction in the model, the erapost-1990 row is the era gap at growth = 0, a comparison at the very edge of the data, so it isn’t a useful number to interpret here.)
Checkpoint 8 · Four assumptions and the VIF checked
Your notebook has bp_aug; the residual–fitted plot, the two component-plus-residual plots (growth and fatalities), and the scale–location and Q–Q plots for bp_mod2, each with a fig-alt line; the VIFs (both 1.05); and the check_model() six-panel view. In the residual–fitted, scale–location, and Q–Q plots, one election, 2000, sits apart from the rest.
Step 9 · Influence and Cook’s distance
In your notebook — this step’s chunks go under # Step 9 · Influence and Cook's distance.
Even when every assumption holds, a few observations can have outsized influence on the fitted coefficients. Cook’s distance summarizes, for each observation, how much the fitted regression would change if that observation were removed. A common screening rule flags \(D_i > 4/n\) as potentially influential; with n = 17, the threshold is \(4/17 \approx 0.235\).
Targets
- Sort the elections by Cook’s distance. The .cooksd column is already in bp_aug: select() year, .cooksd, .resid, and .hat, then sort largest first with arrange(desc(.cooksd)). M12 pre-study · Activity 3.2
- Chart Cook’s distance (code given below).
- Refit without the two elections that cross the line (code given below), and call it bp_mod2_no_flags. M12 Module · Run it both ways
- Refit again without the two wartime elections, 1952 and 1968, by adapting that code, and call it bp_mod2_no_wartime. M04 Module · filter() (keeping rows with
!and%in%)
Cook’s distance chart
The chart takes no new ideas, so the code is given, alt text included. Copy it into your Step 9 section. You don’t need to label the columns: the scale_x_continuous() line puts a tick at every other election, and your sorted list confirms which column is which.
#| fig-alt: "Column chart of Cook's distance for each election under bp_mod2, by election year, with a dashed horizontal line at the 4/n screening threshold."
bp_aug |>
ggplot(aes(x = year, y = .cooksd)) +
geom_col() +
geom_hline(yintercept = 4 / nrow(bread_peace), linetype = "dashed") + # the 4/n screen
scale_x_continuous(breaks = seq(1952, 2016, by = 8)) + # a tick every other election
labs(
x = "Election year",
y = "Cook's distance",
title = "Cook's distance per election · bp_mod2"
)Before you open the check below, read your sorted list and your chart: which elections cross the dashed line, and are they the two you predicted in last week’s debrief?
The page’s version of the chart also colors the columns above the line and prints the year above the tallest ones.

The with-and-without sensitivity check
A sensitivity check turns Cook’s-distance flags into evidence about your conclusions: refit the model without the flagged elections and compare the coefficients to the original fit. If they change only modestly, the original fit was robust; if they change a lot, it was driven by those few elections. The refit is the same formula on bread_peace with the two flagged years filtered out, so the code is given. Run it in your notebook:
bp_mod2_no_flags <- lm(
vote ~ growth + fatalities,
data = bread_peace |> filter(!year %in% c(1952, 2000)) # drop the two flagged elections
)
bp_mod2_no_flags |> tidy(conf.int = TRUE)Then copy the same code, change c(1952, 2000) to c(1952, 1968) (and update its comment) so it drops the two wartime elections while keeping 2000, and call the model bp_mod2_no_wartime. If your copy includes a #| label: line, change it too: two chunks with the same label stop a render.
| fit | term | estimate | std.error | conf.low | conf.high | p.value |
|---|---|---|---|---|---|---|
| Full data (N = 17) | (Intercept) | 44.952 | 1.441 | 41.861 | 48.042 | < .001 |
| Full data (N = 17) | growth | 3.477 | 0.557 | 2.283 | 4.671 | < .001 |
| Full data (N = 17) | fatalities | -0.047 | 0.011 | -0.071 | -0.023 | .001 |
| Without 1952, 2000 (N = 15) | (Intercept) | 44.742 | 1.164 | 42.205 | 47.279 | < .001 |
| Without 1952, 2000 (N = 15) | growth | 3.773 | 0.461 | 2.768 | 4.778 | < .001 |
| Without 1952, 2000 (N = 15) | fatalities | -0.043 | 0.014 | -0.072 | -0.013 | .009 |
| Without 1952, 1968 (N = 15) | (Intercept) | 44.526 | 1.796 | 40.613 | 48.438 | < .001 |
| Without 1952, 1968 (N = 15) | growth | 3.567 | 0.631 | 2.193 | 4.942 | < .001 |
| Without 1952, 1968 (N = 15) | fatalities | 0.100 | 0.310 | -0.574 | 0.775 | .752 |
Checkpoint 9 · You found the influential elections
Your sorted list and chart flag 2000 (\(D\) = 0.251) and 1952 (\(D\) = 0.244) above \(4/n\) = 0.235, with 1968 third (\(D\) = 0.115). Your two refits give a fatalities slope of b = -0.043 without 1952 and 2000 (95% CI [-0.072, -0.013]) and b = 0.100 without 1952 and 1968 (95% CI [-0.574, 0.775]).
Step 10 · The final forecast
In your notebook — this step’s chunks go under # Step 10 · The final forecast.
The final model is still bp_mod2. The diagnostics revealed limitations, but no specific, correctable problem (such as a clear curve or a data-entry error) that would justify a different model. Changing the model now, after seeing which elections it leans on and how 2020 turned out, would be the specification searching the M12 Module warns about: the honest choice is to keep the model you specified and report what the diagnostics showed. The Step 9 refits belong in a report as sensitivity analyses, not as replacements. So the final forecast is last week’s, and there’s nothing to recompute.
Targets
- Print your Step 7 forecast objects, new_ci_m2 and new_pi_m2.
- Print new_elections_pi, the M10 lab’s Step 4 SLR forecast, beside them, to compare.
| Scenario | Actual | M10 SLR fit [95% PI] | M11/M12 MLR fit [95% PI] |
|---|---|---|---|
| 2020 (Trump) | 47.73 | 56.09 [47.00, 65.18] | 57.89 [51.47, 64.31] |
| 2024 (Harris) | 49.25 | 47.88 [38.79, 56.97] | 48.29 [41.93, 54.65] |
Checkpoint 10 · The final forecast
Your Step 10 section prints the final forecast, unchanged from the M11 lab: 2020 fit 57.89, 95% PI [51.47, 64.31]; 2024 fit 48.29, 95% PI [41.93, 54.65], beside the M10 SLR’s.
Lab debrief · 15 minutes
Before you do the final render, save your work and look up. We will spend the last fifteen minutes on what the diagnostics show, and on the three-lab arc.
Take one quiet minute to skim the questions below, then we’ll discuss as a group. They feed straight into your reflection.
Lab debrief · what do the diagnostics show?
The sticking point. Where did you get stuck today? The residual–fitted plot, the check_model() panels, the refits — somewhere else? Naming the sticking point helps the next student over it.
Reading the diagnostic plots. Across your residual–fitted, scale–location, and Q–Q plots, did anything look like a systematic violation — a curve, a funnel — or only bends that follow one or two elections? Which election kept turning up, and where? Did any check_model() panel disagree with what you saw in your own plots? And in your two component-plus-residual plots: does growth’s line need to bend? What can’t the fatalities plot tell you, and why?
Normality and the forecasts. The Q–Q plot’s lowest point, 2000, sits well below the line. If the errors really have a heavier lower tail, which would that affect more: the coefficients, or the 2020 and 2024 prediction intervals? Why does it matter that 2020 fell below its forecast?
The Cook’s-distance surprise. Last week you predicted the two most influential elections. The top two are 2000 and 1952, with 1968 a distant third. Cook’s distance combines two things: what are they, and how do 2000 and 1952 each reach the top in a different way? (Your sorted list’s .resid and .hat columns have the answer.)
The peace half of Hibbs. Compare the fatalities rows across your two refits. Dropping 1952 and 2000 barely moves the slope; dropping 1952 and 1968 flips its sign and leaves its CI spanning zero widely. What does that mean for how confidently we can generalize Hibbs’s peace mechanism beyond Korea and Vietnam?
Why keep the model? The diagnostics found real limitations, and the model missed 2020. Why is it more honest to keep bp_mod2 and report those limitations than to drop elections or add terms until 2020 fits?
Step 11 · Reflection · what you did and learned (after the lab)
In your notebook — your reflection goes under # Step 11 · Reflection · what you did and learned, as plain text, with no code chunk.
Write this after the lab; it’s due with your notebook by 11:59 PM on the Tuesday after the lab. First, scroll back through your notebook, every table and plot from Step 0 to Step 10, and reread the debrief questions from all three labs (M10, M11, and today’s above). Then write three or four paragraphs describing what you did and what you learned.
This is an informal reflection, not an APA results section: write in your own voice, in plain language a smart friend outside the course could follow. Mention a number where it helps (typing it from your output is fine), but there’s no required format, no inline R, and no references. Some questions to get you started; you don’t need to answer all of them:
- What did you do? Trace the arc: bread alone, then bread and peace together, then the diagnostics, with the 2020 and 2024 forecasts along the way.
- What did you learn about Hibbs’s Bread + Peace theory? How well do these 17 elections support each half of it, and which parts rest on just a few elections?
- What surprised you? The 2020 forecast, the Cook’s-distance ranking, something in the diagnostics, or something else?
- What can’t this analysis tell us? Think about the sample size, the independence of the elections, association versus causation, and the assumption of additivity.
- What will you carry forward, into Project 2 or your own research?
Checkpoint 11 · The three-lab arc, in your words
Your Step 11 section has three or four paragraphs on what you did across the three labs and what you learned, written after you reviewed your outputs and the three debriefs.
Before you leave · render, save, and finish the reflection
Today is the final lab session of the three-lab Bread + Peace arc. Before you walk out:
- Render your
bread_peace_analysis.qmd. If it doesn’t render, this is the moment to fix it. - Save your work to GitHub (commit + push in GitHub Desktop) so the cumulative notebook is preserved.
- After the lab, by 11:59 PM on the Tuesday after it: finish any unfinished code, write the Step 11 reflection, and render again.
- Submit the rendered HTML (not the
.qmd) on Canvas, so the grader can read it without re-running, then commit and push once more.
Double check
Before you submit:
What you just did, in research terms
Over three weeks you ran the whole arc of an applied regression analysis. You built a model up from a single predictor, watched it improve, and then checked how far to trust it. You saw that a headline R² can hide the fact that half a model’s story rests on two data points; that the most influential observation can be one you wouldn’t guess; that an assumption you can’t fully check belongs in a report as a stated limitation; and that the honest response to a model that misses 2020 is to report the miss and a plausible reason, not to re-engineer the model until the miss disappears. That discipline — specify, check, report the caveats, resist the urge to overfit — is what lets your conclusions mean what you say they mean, and it’s the habit your group projects need now.