Afterword
The workflow, and what comes next
After Lecture 33 · the course on one page, the habits that matter most, how to read the applied literature critically, the open problems in Bayesian and causal AI, and ten publishable projects
Thirty-two lectures ago, Chapter 1 asked whether a vaccine worked, drew the trial as a causal graph and computed a posterior from two counts. Chapter 14 fitted a Bayesian neural network to estimate the effect of a programme for low-birth-weight children, one child at a time. In between, the models grew from two parameters to several hundred, and the data from a table of counts to some fourteen thousand answers written by people and by ChatGPT. The way of working did not change. This afterword sets that way of working out on one page and picks out the habits that mattered most in the case studies. Then it turns outward: how to read the applied papers that use these methods and what to ask of them, how to check a published result for yourself, which problems are still open, and how to turn reading into research. It ends with ten project ideas, in quantum computing, football, number theory and algebraic geometry, education and literature, each worked out to the point where it could be started next week and, with good execution, published.
A.1 The workflow on one page
Every analysis in the course followed the same loop. It starts from a question, not from a data set, and it ends with a report that says what was assumed and how sensitive the answer is to it. The loop is drawn below; the table says what each step asks and where the course practised it.
| Step | What it asks | Where the course practised it |
|---|---|---|
| Question and estimand | Which quantity, for which population, under which intervention? Prediction, description or cause? | Chapter 1 (vaccine trial); Chapter 13 (ATE versus ATT); Chapter 14 (individual effects) |
| Graph | What causes what? Which variables are confounders, mediators, colliders? What is unmeasured? | Chapters 1–2; the Table 2 fallacy in Chapter 10; the detector's DAG in Chapter 12; the back door, instruments and front door in Chapter 13 |
| Identification | Can the estimand be computed from the observable distribution, given the graph? If not, what extra assumption or data would make it so? | Chapter 13 throughout; the hidden-confounder widget in Chapter 14 |
| Prior | What do we believe before the data, on the scale of the outcome? Simulate it and look. | Prior predictive simulation from Chapter 2 onwards; network priors over functions in Chapter 14 |
| Fit | Which algorithm, and is it good enough for this model? HMC by default; approximations when they are checked. | Chapter 5 (MCMC); Chapter 9 (variational inference); Laplace and ensembles in Chapters 10 and 14 |
| Diagnose | Did the computation work? , effective sample size, divergences, on quantities that are identified. | Chapter 5; label switching in Chapter 11; weights versus functions in Chapter 14 |
| Check | Does the model reproduce the features of the data that matter? Does it predict data it has not seen, including data from somewhere else? | Posterior predictive checks from Chapter 3; leave-one-out comparison from Chapter 1 on, explained in Chapter 9; calibration and out-of-domain tests in Chapters 12 and 14; benchmarks with known truth in Chapters 13–14; the corners of a copula against the data in Chapter 11 |
| Report | Estimate with uncertainty, the assumptions it rests on, and what would change it. | The Research Practice boxes in every chapter; methods-paragraph exercises in Chapters 7, 9, 10 and 13 |
| Sensitivity | How strong would a violation of an untestable assumption have to be to change the conclusion? | Missing-data sensitivity in Chapter 7; the tipping point in Chapter 13; priors over worlds in Chapter 14 |
Two features of the loop deserve emphasis. First, the graph and the prior come before the fit, because they are statements about the world, and the data cannot be the source of the assumptions used to analyse them without circularity. Second, the loop has exits that go back to the start. A posterior predictive check that fails is not a nuisance to be explained away; it is the data telling us that a step upstream was wrong. Gelman et al. (2020) call this process the Bayesian workflow, and stress that the sequence of models fitted along the way, not only the last one, is part of the scientific result.
A.2 Seven habits from the case studies
The case studies were chosen because each could go wrong in an instructive way. Looking back, seven habits did most of the work of keeping them right.
- Draw the graph before touching the data. The naive comparison in the job-training study got the sign of the effect wrong, and the graph said why before any model was fitted: the comparison men would have earned more with or without training.
- Simulate the prior. Priors that look harmless on the parameter scale can be absurd on the outcome scale. Every chapter that introduced a new kind of model drew from the prior first.
- Judge convergence on what is identified. Mixture labels (Chapter 11) and network weights (Chapter 14) are not identified; cluster memberships and predicted effects are. A large on the wrong quantity is not a failure, and a small one on the right quantity is only necessary, not sufficient.
- Check on data the model has not seen, from somewhere else if possible. The AI-text detector was 96% accurate on finance answers and much less accurate on open-domain answers. Only the second number says what the detector learned.
- Prefer benchmarks with known truth. The IHDP benchmark, where every child's effect is known, separated methods that the job-training data could not.
- Report an interval, then ask what would move it. The job-training estimate was consistent with the experiment, and an unmeasured confounder whose effect on earnings times its excess prevalence among trainees came to only $40 would have pushed its interval to zero. Both statements belong in the report.
- Prefer a simpler method that encodes the right assumption over a flexible one that does not. The adjusted regression beat the amortised network outside its training prior because it encodes the identification argument directly. Flexibility is valuable for the structural equations, not as a replacement for the graph.
Research Practice: A Checklist for Any Bayesian Causal Analysis
- State the estimand in words and in notation, including the population.
- Show the DAG, say which variables are unmeasured, and give the adjustment set or identification strategy.
- Report priors, the reasons for them, and a prior predictive check.
- Name the software and algorithm, the number of chains and draws, and the diagnostics on identified quantities.
- Show a posterior predictive check and an out-of-sample or out-of-domain check.
- Report overlap (for causal estimates) and how the estimand changed if the sample was trimmed.
- Give a sensitivity analysis for the strongest untestable assumption.
- Share code and, where possible, data, so that every number in the paper can be reproduced.
A.3 The anatomy of an applied Bayesian paper
An applied statistics paper makes a claim about the world, not about a method, and its evidence is a model together with the checks that make the model believable. Most papers in journals such as the Annals of Applied Statistics, the Journal of the Royal Statistical Society (Series A and C), Bayesian Analysis or a field journal that publishes Bayesian work follow the same plan. Each part answers one question, and each question has a home in this course.
| Part | The question it answers | What to look for | Course |
|---|---|---|---|
| Abstract and introduction | What is the claim? | Write it in one sentence before reading on (below). Is the question descriptive, predictive or causal? | Ch 1, 13 |
| Data | How did these numbers come to exist? | Who was sampled, who is missing, how each variable was measured, what was excluded and why | Ch 7, 12 |
| Model | What exactly was fitted? | The likelihood, the priors, the hierarchy and, explicit or not, the causal graph. Rewrite the model in your own notation | Ch 2–4, 6, 8 |
| Computation | Did the fitting work? | Algorithm and software; , effective sample sizes, divergences; how approximations were validated | Ch 5, 9 |
| Checks | Does the model describe the data, and predict new data? | Posterior predictive checks with statistics that matter, cross-validation, calibration, a simulation study with known truth | Ch 3, 4, 10, 12 |
| Results | How big, and how sure? | Intervals on an interpretable scale, figures of posteriors and predictions, not only tables of coefficients | Ch 3–6 |
| Sensitivity | What would change the answer? | Alternative priors, likelihoods and adjustment sets; sensitivity to untestable assumptions | Ch 7, 13 |
| Discussion and supplement | Where does it apply, and can I check it? | Stated limitations; the code and data, which are often where the real model is | all |
A good order for a first reading is: abstract, then the figures and tables, then the model section, with a pen, then the checks, and only then the introduction and discussion. The figures show what the authors think the evidence is; writing out the model shows whether you understand it; and reading the introduction last protects you from adopting the authors' framing before you have seen what they did.
Before going further, write the paper's claim in the form
Under assumptions A, the data D imply that the quantity Q is about X (interval I), which matters because Y.
Every slot does work. If you cannot name Q, the paper may not have an estimand (Lundberg, Johnson and Stewart, 2021). If A is empty, the assumptions are hidden, usually in a regression that is being read causally. If there is no interval, or it is on a scale nobody can interpret, the claim cannot be weighed. And Y is where papers most often overreach, by drawing a policy conclusion from a descriptive estimate.
The widget collects the notation of the whole course, so that a symbol met in a paper can be traced back to the chapter that explained it.
Two warnings about notation in the literature. Symbols are reused: in this course is a between-group standard deviation (Chapter 6), a global shrinkage scale (Chapter 10) and a treatment effect (Chapters 13–14), and papers are no more consistent. And parameterisations differ: a normal distribution may be written with a standard deviation (as here, and in Stan), a variance or a precision (as in BUGS and JAGS), and a gamma distribution with a rate or a scale. When a prior looks strange, check which convention the paper uses before concluding that the authors were careless.
A.4 Questions to ask of an article
Eight questions catch most weak applied papers. They follow the workflow of the course, and the answers are usually in the methods section, the supplement or the code.
- What is the estimand, and is it the one the conclusions talk about? A model of association reported as an effect is the commonest mistake in applied work (Chapter 13); so is an average over a population different from the one the conclusion is about.
- How did the data come to be? Selection, nonresponse and measurement are where most of the uncertainty that is not in the interval lives (Chapter 7). The HC3 detector of Chapter 12 learned how one data set was scraped.
- Does the structure of the model match the structure of the data? Repeated measures without a hierarchy, time series treated as independent observations (Chapter 8) and crossed factors modelled as nested all make intervals too narrow.
- Were the priors chosen on the outcome scale, and checked? A prior predictive simulation or a sensitivity analysis should be reported (Chapter 2). "Non-informative" priors on many parameters can be strongly informative about the quantities of interest.
- Did the computation work? Diagnostics should be reported on the quantities that are interpreted; approximations (variational inference, Laplace, ensembles) need to be validated against something (Chapters 5, 9, 14).
- Does the model fit, and does it predict data it has not seen? Posterior predictive checks should use statistics that bear on the conclusion, and predictive claims need held-out data, ideally from somewhere else (Chapters 3, 12, 14).
- How big is the effect, and how sure are we? An interval on an interpretable scale, compared with what is already known. A dramatic effect estimated from a small, noisy study is more likely to be exaggerated than real, which the next subsection quantifies.
- What would change the conclusion? Alternative priors, likelihoods and adjustment sets, the strength of unmeasured confounding needed to overturn the result (Chapter 13), and how many analysis choices were made after seeing the data. Are the code and data available, so that you can find out?
Question 7 has a precise version. Gelman and Carlin (2014) suggest asking two things of any study that reports a "significant" estimate: given a plausible true effect and the study's standard error , how often would a significant estimate have the wrong sign (a Type S error), and by how much would it exaggerate the true effect on average (a Type M error, measured by the exaggeration ratio)? The calculation needs no data, only a design and an honest prior guess at the effect size.
The analyses in this afterword use the packages and plotting theme of the course:
library(tidyverse)
library(brms)
library(jsonlite)
options(mc.cores = parallel::detectCores())
harbour <- c(ink = "#10191d", muted = "#4a5f68", grid = "#d5e3e6",
sky = "#1d5187", amber = "#805907", rose = "#ad3b28",
moss = "#1d6b54", lilac = "#5b3a94")
theme_harbour <- function(base_size = 11) {
theme_minimal(base_size = base_size) +
theme(text = element_text(colour = harbour[["ink"]]),
axis.text = element_text(colour = harbour[["muted"]]),
panel.grid.major = element_line(colour = harbour[["grid"]]),
panel.grid.minor = element_blank(),
strip.text = element_text(colour = harbour[["ink"]], hjust = 0),
legend.position = "top")
}
theme_set(theme_harbour())
retrodesign <- function(D, s, alpha = 0.05, n = 1e6) { # Gelman and Carlin (2014), by simulation
z <- qnorm(1 - alpha / 2); est <- rnorm(n, D, s); sig <- abs(est) > z * s
c(power = mean(sig), type_S = mean(sign(est[sig]) != sign(D)), exaggeration = mean(abs(est[sig])) / D)
}
set.seed(33)
s_beauty <- 8 / 2.44 # the published 8-point difference was 2.44 standard errors from zero
rbind(`true effect 0.3 points` = retrodesign(0.3, s_beauty), `true effect 1 point` = retrodesign(1, s_beauty),
`true effect 8 points` = retrodesign(8, s_beauty)) |> round(3)
# the same estimate under a sceptical prior: sex-ratio effects are rarely larger than a point or two
prior_sd <- 0.5; w <- prior_sd^2 / (prior_sd^2 + s_beauty^2)
c(posterior_mean = w * 8, posterior_sd = sqrt(1 / (1 / s_beauty^2 + 1 / prior_sd^2))) |> round(2)
# a literature of such studies: true effects drawn from the sceptical prior, each estimated with the same noise
true <- rnorm(1e5, 0, prior_sd); est <- rnorm(1e5, true, s_beauty); sig <- abs(est) > 1.96 * s_beauty
c(share_significant = mean(sig), mean_abs_estimate_if_significant = mean(abs(est[sig])),
mean_abs_true_effect_if_significant = mean(abs(true[sig])), mean_abs_posterior_mean_if_significant = mean(abs(w * est[sig])),
wrong_sign_if_significant = mean(sign(est[sig]) != sign(true[sig]))) |> round(3)
power type_S exaggeration
true effect 0.3 points 0.051 0.397 25.559
true effect 1 point 0.061 0.196 7.746
true effect 8 points 0.684 0.000 1.213
posterior_mean posterior_sd
0.18 0.49
share_significant mean_abs_estimate_if_significant
0.053 7.677
mean_abs_true_effect_if_significant mean_abs_posterior_mean_if_significant
0.423 0.174
wrong_sign_if_significant
0.368
Suppose the true effect of parents' attractiveness on the proportion of girls is 0.3 percentage points, already generous by the standards of the sex-ratio literature. A study with a standard error of 3.3 points then has a power of 5.1%, barely more than the 5% it would have if there were no effect at all. Of its significant results, 40% would have the wrong sign, and on average they would exaggerate the true effect 26-fold. Even with a true effect of a full point, the exaggeration ratio is 7.7. The design would be adequate (power 68%) only if the true effect were as large as the published 8 points. Combining the published estimate with a sceptical prior (normal, standard deviation 0.5 points) gives a posterior mean of 0.18 points with standard deviation 0.49: the data barely move the prior, which is the honest summary of an uninformative study. The last line simulates a literature of such studies, with true effects drawn from the sceptical prior. Only 5.3% reach significance; those that do report effects averaging 7.7 points when the true effects behind them average 0.42; and 37% have the wrong sign. Shrinking the same significant estimates with the prior gives an average of 0.17 points, far closer to the truth. Publishing only significant results from noisy studies, and reading them at face value, guarantees an exaggerated literature; the prior is the correction.
Check Yourself
The interval excluding zero says little about the size of the effect when the study is this noisy.
Being significant does not make the estimate wrong; it makes it likely to be exaggerated.
With and the power is about 6%, and significant estimates exaggerate the true effect about seven-fold on average (and one in six has the wrong sign). The study is not worthless: it is weak evidence, best combined with what is known through a prior, or with a larger replication. This is the situation of the exam-anxiety project in Section A.9.
Project Connections: The Five Projects, Read Critically
The eight questions of Section A.4 are also a review of the five ongoing projects. For NYC EMS response equity, question 2 (how the data came to be) is decisive: dispatch records start when a call is classified, so delays before that are invisible. For the cancer gene-expression project, question 3 (structure) asks whether batches and cohorts are in the model. For AI-generated text detection, question 6 (out-of-domain checks) is Lecture 32's lesson. For AI tools in university mathematics, question 7 (effect size and noise) and Project 7's design analysis apply directly: a single course section is a small study. For hostile-traffic detection, question 8 (what would change the conclusion) is about adversaries, who change the data in response to the model.
A.5 Four guided dissections
Each dissection applies Sections A.3 and A.4 to a well-known paper: the claim, the evidence that carries it, the check that matters most and what the paper does not show. The four cover the main kinds of applied Bayesian argument: priors that discipline a surprising result, a model that corrects a biased sample, a hierarchical model for prediction, and a synthesis of many studies.
dissection 1 (priors and noise) — Kanazawa, "Beautiful parents have more daughters" (2007), and Gelman and Weakliem, "Of beauty, sex and power" (2009)
Claim. Using about 3,000 respondents to an American adolescent-health survey, Kanazawa reported that the children of parents rated "very attractive" were girls 56% of the time, against 48% for other parents: an 8-point difference, 2.44 standard errors from zero.
Key evidence. One comparison, chosen from several natural ones (five attractiveness categories, several ways of grouping them); the regression of sex ratio on attractiveness was not significant (estimate 1.5, standard error 1.4, in Gelman's account).
The check that matters. Prior knowledge. The proportion of girls at birth is remarkably stable: known factors such as race, parental age and birth order move it by about a percentage point or less, and even extreme poverty and famine by at most about three points. Gelman and Weakliem argue that a plausible effect of beauty is a few tenths of a point, and almost certainly under one point, in either direction, and the retrodesign above shows what follows: with a standard error of 3.3 points, the study has about 5% power, and a significant result is almost bound to be wildly exaggerated and has a large chance of the wrong sign.
What it does not show. It does not show that beauty has no effect on the sex ratio; it shows that this study could not have detected an effect of plausible size. The general lesson, that small studies of small effects produce dramatic, unreplicable estimates, became one of the foundations of the replication debate (history box below).
dissection 2 (survey adjustment) — Wang, Rothschild, Goel and Gelman, "Forecasting elections with non-representative polls" (2015)
Claim. A poll run on the Xbox gaming platform during the 2012 US presidential campaign, whose respondents were 93% male (against 47% of the electorate) and 65% aged 18 to 29 (against 19%), gives accurate election forecasts once it is analysed with multilevel regression and poststratification (MRP).
Key evidence. About 750,000 interviews with 346,000 people. Multilevel logistic regressions estimate vote intention in each of 176,256 cells defined by sex, race, age, education, state, party identification, ideology and 2008 vote; the cell estimates are then weighted by the cells' shares of the electorate, taken from the 2008 exit poll. The day-before-election estimate of Obama's two-party vote share was within 0.6 points of the result, comparable with the poll aggregates, and the median error across states was 1.8 points.
The check that matters. The forecasts were made with information available at the time (2008 exit-poll cell weights, not 2012 ones), and compared with the actual results and with the 2012 exit poll's subgroup estimates. Partial pooling (Chapter 6) is what makes 176,256 cells estimable from a sample that is sparse in most of them.
What it does not show. MRP corrects for selection on the variables used to define the cells; it cannot correct for selection on anything else, such as Xbox users differing politically from demographically similar non-users (a missing-at-random assumption, Chapter 7). The paper used approximate marginal maximum likelihood rather than full Bayesian inference, and its electoral-college intervals were too wide in the tails, which the authors attribute to state-level correlations the model did not capture.
dissection 3 (hierarchical prediction) — Baio and Blangiardo, "Bayesian hierarchical model for the prediction of football results" (2010)
Claim. The goals scored in a football match can be modelled as Poisson counts whose log rates are the sum of a home advantage, the attacking strength of the scoring team and the defensive weakness of the conceding team, with team strengths drawn from common distributions; such a model describes a season of Italy's Serie A well and can predict results.
Key evidence. Posterior predictive checks of the final league table for the 1991–92 Serie A season, team by team, and an application to 2007–08.
The check that matters. The authors noticed that the hierarchical model overshrinks: the best and worst teams are pulled too far toward the middle, so the model underpredicts their points. Their remedy was a mixture prior in which each team's attack and defence each belong to a top, middle or bottom group (Chapter 11), each group with its own distribution of strengths. Noticing the problem required comparing predicted and observed tables at the extremes, not only overall fit.
What it does not show. The paper does not test genuinely out-of-sample predictions against bookmakers' odds, the benchmark that matters for anyone who would use it, nor does it allow team strengths to change during a season. The model descends from Maher (1982) and Dixon and Coles (1997), whose correction for low-scoring draws it does not include. Section A.6 reproduces the basic model on a recent season and makes the comparison with the market.
dissection 4 (research synthesis) — Uttl, White and Wong Gonzalez, "Meta-analysis of faculty's teaching effectiveness" (2017)
Claim. Student evaluations of teaching (SET) are not related to how much students learn. Earlier meta-analyses that found moderate correlations between an instructor's ratings and the learning of their students were artefacts of small studies.
Key evidence. A reanalysis of the multisection studies (courses taught in many sections by different instructors, with a common final exam) behind three earlier meta-analyses, and a new meta-analysis of 97 such studies from 51 articles. Plots of effect size against sample size showed large correlations only in small studies; adjusting for this small-study effect left a correlation near 0.1, and near zero for the studies that also adjusted for students' prior ability.
The check that matters. The funnel-plot logic is a Type M argument across a literature: if small studies report large effects and large studies small ones, the large effects are most likely exaggerated by noise and selective publication. A Bayesian random-effects meta-analysis with study size as a moderator (Chapter 6) makes the same point with an explicit model.
What it does not show. That SETs measure nothing: they may measure student satisfaction, and they are affected by things other than teaching, such as an instructor's gender. That last question is causal, and the strongest evidence for it comes from designs, not meta-analysis: MacNell, Driscoll and Hunt (2015) randomised the perceived gender of online instructors, and Boring, Ottoboni and Stark (2016) analysed a French university where students were assigned to sections, and found that ratings were affected by gender and only weakly related to exam performance. Project 6 in Section A.9 builds on both.
History: The Replication Crisis and the Bayesian Response
In 2005 John Ioannidis published "Why most published research findings are false", arguing from the arithmetic of low power, small effects and flexible analyses that a majority of significant findings in some fields must be false. In 2011 a respected psychology journal published nine experiments claiming evidence for precognition (Bem, 2011), and the same year Simmons, Nelson and Simonsohn showed how undisclosed flexibility in data analysis could make almost anything "significant". The Open Science Collaboration (2015) then repeated 100 psychology studies: 97% of the originals had reported significant results, but only 36% of the replications did, and the replications' effects were on average about half the size of the originals'. Statisticians had been warning of the mechanisms for decades. Andrew Gelman and Eric Loken named the subtler one the "garden of forking paths" (2014): researchers need not fish deliberately for significance if the analysis they would have done depends on the data they happen to see. The Bayesian response has been less about Bayes factors than about the workflow of this course: priors that encode what is already known about effect sizes, multilevel models that partially pool many comparisons instead of correcting for them, reporting of intervals rather than thresholds, and preregistration and registered reports so that the forking paths are fixed before the data arrive.
A.6 Reproducing a result: a season of the Premier League
Reading a paper well ends with checking it, and the best check is to reproduce its central result on new data. We reproduce the model of dissection 3 on the 2023–24 English Premier League, using the results published by the openfootball project. To make the test honest, we fit the model to the first 28 rounds of the season (280 matches) and predict the last 10 (100 matches), as a forecaster in March 2024 would have had to.
The model, for the goals scored by team against team , with for the home side, is
where is team 's attacking strength and is how many goals team concedes relative to an average defence (larger is worse). The two goal counts in a match are treated as independent given the rates, as Baio and Blangiardo did; Section 11.15 checks this assumption with a copula on six Premier League seasons and finds only a weak negative dependence, which mainly lowers the predicted share of 0–0 draws. In brms it is a Poisson regression with two crossed random intercepts (Chapter 6).
epl <- fromJSON("https://raw.githubusercontent.com/openfootball/football.json/master/2023-24/en.1.json")$matches |>
as_tibble() |>
mutate(round = as.integer(str_extract(round, "\\d+")), home_goals = map_int(score$ft, 1), away_goals = map_int(score$ft, 2),
across(c(team1, team2), ~ str_remove(.x, " FC$|^AFC "))) |>
select(round, date, home = team1, away = team2, home_goals, away_goals)
to_long <- function(d) bind_rows( # one row per team per match
tibble(match = seq_len(nrow(d)), attack = d$home, defence = d$away, home = 1, goals = d$home_goals),
tibble(match = seq_len(nrow(d)), attack = d$away, defence = d$home, home = 0, goals = d$away_goals))
first28 <- filter(epl, round <= 28); last10 <- filter(epl, round > 28)
c(matches = nrow(epl), teams = n_distinct(epl$home), fitted_on = nrow(first28), predicted = nrow(last10),
home_goals_per_match = round(mean(epl$home_goals), 2), away_goals_per_match = round(mean(epl$away_goals), 2))
matches teams fitted_on
380.00 20.00 280.00
predicted home_goals_per_match away_goals_per_match
100.00 1.80 1.48
m_epl <- brm(goals ~ 1 + home + (1 | attack) + (1 | defence), data = to_long(first28), family = poisson(),
prior = c(prior(normal(0, 1), class = Intercept), prior(normal(0, 0.5), class = b),
prior(exponential(2), class = sd)),
seed = 33, refresh = 0, file = "fits/aw_epl")
m_flat <- brm(goals ~ 1 + home, data = to_long(first28), family = poisson(), # baseline: no team strengths
prior = c(prior(normal(0, 1), class = Intercept), prior(normal(0, 0.5), class = b)),
seed = 33, refresh = 0, file = "fits/aw_epl_flat")
summary(m_epl)$fixed[, c("Estimate", "l-95% CI", "u-95% CI", "Rhat")] |> round(3)
VarCorr(m_epl) |> map(~ round(.x$sd[, c("Estimate", "Q2.5", "Q97.5")], 3))
Estimate l-95% CI u-95% CI Rhat
Intercept 0.342 0.160 0.524 1.001
home 0.168 0.041 0.295 1.003
$attack
Estimate Q2.5 Q97.5
0.261 0.156 0.395
$defence
Estimate Q2.5 Q97.5
0.213 0.117 0.337
The fit is quick and clean (all values 1.00). An average team scores goals per match away from home, and the home side scores times as many (95% interval 1.04 to 1.34): about 18% more. Teams differ more in attack than in defence: the standard deviation of attacking strength is 0.26 on the log scale (0.16 to 0.40), that of defensive weakness 0.21 (0.12 to 0.34). The figure shows the estimates, with wide intervals after 28 matches per team.
re <- ranef(m_epl, probs = c(0.05, 0.95))
strength <- tibble(team = rownames(re$attack), att = re$attack[, "Estimate", 1], att_lo = re$attack[, "Q5", 1], att_hi = re$attack[, "Q95", 1]) |>
left_join(tibble(team = rownames(re$defence), def = re$defence[, "Estimate", 1], def_lo = re$defence[, "Q5", 1], def_hi = re$defence[, "Q95", 1]), by = "team")
ggplot(strength, aes(att, def)) +
geom_hline(yintercept = 0, colour = harbour[["grid"]]) + geom_vline(xintercept = 0, colour = harbour[["grid"]]) +
geom_errorbarh(aes(xmin = att_lo, xmax = att_hi), height = 0, colour = harbour[["sky"]], alpha = 0.5) +
geom_errorbar(aes(ymin = def_lo, ymax = def_hi), width = 0, colour = harbour[["sky"]], alpha = 0.5) +
geom_point(colour = harbour[["rose"]], size = 2) +
ggrepel::geom_text_repel(aes(label = team), size = 2.8, colour = harbour[["ink"]], seed = 3, min.segment.length = 0.2,
segment.colour = harbour[["muted"]], max.overlaps = 30) +
labs(x = "attacking strength (log goals scored, relative to average)", y = "defensive weakness (log goals conceded)")
Now the test that matters: predictions for the 100 matches the model has not seen. We score them in two ways. The log score is the log of the predicted probability of the exact score that occurred, summed over matches (higher is better; Chapter 10). The Brier score compares the predicted probabilities of a home win, a draw and an away win with what happened (lower is better). The baseline is the model without team strengths, which knows only that home sides score more.
set.seed(33)
pred_long <- to_long(last10); M <- nrow(last10)
log_score <- function(m) { # log predictive probability of each exact score, averaged over draws
lam <- posterior_epred(m, newdata = pred_long)
ll <- dpois(matrix(pred_long$goals, nrow(lam), ncol(lam), byrow = TRUE), lam, log = TRUE)
log(colMeans(exp(ll[, 1:M] + ll[, M + 1:M])))
}
ls_epl <- log_score(m_epl); ls_flat <- log_score(m_flat)
outcome_probs <- function(m) { y <- posterior_predict(m, newdata = pred_long, cores = 1); h <- y[, 1:M]; a <- y[, M + 1:M]
cbind(home = colMeans(h > a), draw = colMeans(h == a), away = colMeans(h < a)) }
observed <- with(last10, cbind(home = home_goals > away_goals, draw = home_goals == away_goals, away = home_goals < away_goals))
brier <- function(p) mean(rowSums((p - observed)^2))
p_epl <- outcome_probs(m_epl)
c(log_score_hierarchical = sum(ls_epl), log_score_baseline = sum(ls_flat), difference = sum(ls_epl - ls_flat),
se_difference = sd(ls_epl - ls_flat) * sqrt(M),
brier_hierarchical = brier(p_epl), brier_baseline = brier(outcome_probs(m_flat)),
favourite_won = mean(apply(p_epl, 1, which.max) == apply(observed, 1, which.max))) |> round(3)
log_score_hierarchical log_score_baseline difference
-312.308 -326.909 14.602
se_difference brier_hierarchical brier_baseline
4.408 0.562 0.642
favourite_won
0.550
Over the 100 unseen matches the hierarchical model's log score is −312.3, against −326.9 for the baseline: a difference of 14.6 with a standard error of 4.4, so the team strengths carry real information about future matches. The Brier score falls from 0.642 for the baseline to 0.562 (always predicting one third for each outcome would score 0.667). The outcome the model thought most likely happened in 55% of matches, a respectable figure for a low-scoring game in which the better side often fails to win.
Finally, the posterior predictive distribution of the final table: simulate the last ten rounds 4,000 times from the posterior, add the points already won, and compare with what happened.
points <- function(gf, ga) 3 * (gf > ga) + (gf == ga)
won28 <- bind_rows(tibble(team = first28$home, pts = points(first28$home_goals, first28$away_goals)),
tibble(team = first28$away, pts = points(first28$away_goals, first28$home_goals))) |> count(team, wt = pts, name = "after_28")
final <- bind_rows(tibble(team = epl$home, pts = points(epl$home_goals, epl$away_goals)),
tibble(team = epl$away, pts = points(epl$away_goals, epl$home_goals))) |> count(team, wt = pts, name = "actual")
set.seed(34); y <- posterior_predict(m_epl, newdata = pred_long, cores = 1); teams <- sort(won28$team)
sim <- sapply(seq_len(nrow(y)), function(i) { # teams x draws: simulated final points
h <- y[i, 1:M]; a <- y[i, M + 1:M]
extra <- tapply(c(points(h, a), points(a, h)), c(last10$home, last10$away), sum)[teams]
won28$after_28[match(teams, won28$team)] + extra })
pos <- apply(sim + matrix(runif(length(sim), 0, 0.1), nrow(sim)), 2, function(p) rank(-p)) # random tie-break
tibble(team = teams, after_28 = won28$after_28[match(teams, won28$team)], predicted = rowMeans(sim),
lo90 = apply(sim, 1, quantile, 0.05), hi90 = apply(sim, 1, quantile, 0.95),
p_champion = rowMeans(pos == 1), p_relegated = rowMeans(pos >= 18)) |>
left_join(final, by = "team") |> arrange(desc(predicted)) |> mutate(across(where(is.double), ~ round(.x, 2))) |> as.data.frame()
team after_28 predicted lo90 hi90 p_champion p_relegated
1 Liverpool 64 83.90 77 91 0.41 0.00
2 Arsenal 64 83.62 76 90 0.38 0.00
3 Manchester City 63 81.53 74 88 0.20 0.00
4 Aston Villa 55 70.03 63 77 0.00 0.00
5 Tottenham Hotspur 53 69.34 62 76 0.00 0.00
6 Manchester United 47 61.03 54 68 0.00 0.00
7 Chelsea 42 57.64 50 65 0.00 0.00
8 Newcastle United 40 57.52 50 65 0.00 0.00
9 Brighton & Hove Albion 42 55.06 48 62 0.00 0.00
10 West Ham United 43 54.97 48 62 0.00 0.00
11 Wolverhampton Wanderers 41 54.04 47 61 0.00 0.00
12 Fulham 35 48.35 41 56 0.00 0.00
13 Bournemouth 35 47.20 40 54 0.00 0.00
14 Everton 31 43.69 37 51 0.00 0.01
15 Brentford 26 39.72 33 47 0.00 0.06
16 Crystal Palace 29 39.59 33 47 0.00 0.05
17 Nottingham Forest 24 36.71 30 44 0.00 0.21
18 Luton Town 21 32.08 25 39 0.00 0.68
19 Burnley 14 23.82 18 31 0.00 0.98
20 Sheffield United 14 21.56 16 28 0.00 1.00
actual
1 82
2 89
3 91
4 68
5 66
6 60
7 63
8 60
9 48
10 52
11 46
12 47
13 48
14 48
15 39
16 49
17 36
18 26
19 24
20 16
With ten rounds to go, the model saw a three-way title race: Liverpool 41%, Arsenal 38% and Manchester City 20%. City won the title with 91 points, above the top of its 90% interval (74 to 88), after taking 28 of the last 30 points available. Seventeen of the twenty final totals fall inside their 90% intervals; the three misses are City and Crystal Palace, who finished much better than predicted, and Wolverhampton Wanderers, who finished worse. The three teams the model thought most likely to be relegated (Sheffield United, 100%; Burnley, 98%; Luton Town, 68%) were the three relegated. Two remarks. The totals here count points won on the pitch; Everton and Nottingham Forest had points deducted during the season for breaching the league's financial rules, which changed the official table but not what the model had to predict. And the miss at the top is the overshrinkage of dissection 3: the hierarchical prior pulls the strongest team toward the middle, so the model underrates exactly the team most likely to keep winning (Exercise 3).
The real benchmark for a football forecast is the betting market. Bookmakers' odds are public, and the closing odds of a high-volume bookmaker such as Pinnacle, the last odds offered before kick-off, are usually taken as the market's best estimate. Converting odds to probabilities means inverting them and removing the bookmaker's margin, which makes the three inverted odds add up to slightly more than one; we divide by their sum. The football-data.co.uk archive has these odds for every match of the season.
odds <- read_csv("https://www.football-data.co.uk/mmz4281/2324/E0.csv", show_col_types = FALSE) |>
mutate(across(c(HomeTeam, AwayTeam), ~ recode(.x, Brighton = "Brighton & Hove Albion", Luton = "Luton Town",
`Man City` = "Manchester City", `Man United` = "Manchester United", Newcastle = "Newcastle United",
`Nott'm Forest` = "Nottingham Forest", Tottenham = "Tottenham Hotspur", `West Ham` = "West Ham United",
Wolves = "Wolverhampton Wanderers"))) |>
select(home = HomeTeam, away = AwayTeam, PSCH, PSCD, PSCA) # Pinnacle closing odds
mk <- left_join(select(last10, home, away), odds, by = c("home", "away"))
stopifnot(!anyNA(mk$PSCH))
inv <- 1 / as.matrix(mk[, c("PSCH", "PSCD", "PSCA")])
c(mean_margin = mean(rowSums(inv)) - 1) |> round(3)
p_market <- inv / rowSums(inv) # implied probabilities, margin removed
p_blend <- (p_epl + p_market) / 2
log_loss <- function(p) -mean(log(rowSums(p * observed))) # log probability of the actual result
scores <- rbind(model = c(brier = brier(p_epl), log_loss = log_loss(p_epl)),
market = c(brier(p_market), log_loss(p_market)), blend = c(brier(p_blend), log_loss(p_blend)))
d_ll <- log(rowSums(p_epl * observed)) - log(rowSums(p_market * observed))
round(rbind(scores, `model minus market (log score)` = c(NA, mean(d_ll)), `standard error` = c(NA, sd(d_ll) / sqrt(M))), 3)
# a naive value-betting rule: stake 1 unit whenever the model's probability times the odds exceeds 1.1
o <- as.matrix(mk[, c("PSCH", "PSCD", "PSCA")]); bet <- p_epl * o > 1.1
ret <- (o * observed - 1)[bet]
c(bets = sum(bet), mean_return_per_bet = mean(ret), standard_error = sd(ret) / sqrt(sum(bet))) |> round(3)
mean_margin
0.03
brier log_loss
model 0.562 0.955
market 0.507 0.874
blend 0.529 0.908
model minus market (log score) NA -0.082
standard error NA 0.022
bets mean_return_per_bet standard_error
107.000 -0.345 0.212
The market wins clearly. Pinnacle's margin is small (the inverted closing odds sum to about 1.03), and its implied probabilities score a Brier score of 0.507 and a log loss of 0.874 on the 100 held-out matches, against 0.562 and 0.955 for our model. The difference in log score, 0.082 per match with a standard error of 0.022, is nearly four standard errors, and averaging the model with the market (0.908) is worse than the market alone, so the model adds nothing the market lacks. The betting rule makes the same point in money: the model saw a 10% edge on 107 occasions spread across home wins, draws and away wins, and those bets lost an average of 35 pence per pound staked (standard error 21 pence). The market knows what the model does not: injuries, rotation, form within the season, and everything that a model with constant team strengths and Poisson goals leaves out. That is not a failure of the reproduction. It is the benchmark against which any extension of the model should be judged, and it is far harder to beat than a model with no team strengths.
The exercise has reproduced the paper's two findings, that the simple hierarchical model predicts much better than no model and that it shrinks the extremes, and has added the two checks the paper lacked: genuinely out-of-sample prediction, and a comparison with the betting market. It also shows how a reproduction becomes a project: the natural next steps (strengths that drift during a season, Chapter 8; the Dixon–Coles correction for low scores; information the market uses and the model does not, such as injuries) are each a modest extension, and whether any of them closes the gap to the market, over several seasons, is a publishable question in its own right.
A.7 Open problems
The last two chapters ended at the edge of current research. The problems below are open in the literal sense: there is active work on each, and none has a settled answer. Each also connects to at least one of the five projects.
1. What does a prior on weights mean?
For a network with millions of weights, independent normal priors are a convenience, not a belief. Chapter 14's widget showed that they induce priors over functions that change character with the width of the network and the scale of the weights. How to choose priors that encode real knowledge about functions, such as smoothness, monotonicity or invariance, and how much the choice matters for the posterior of large networks, is reviewed by Fortuin (2022) and remains open. The position paper of Papamarkou et al. (2024) argues that Bayesian deep learning is needed precisely for the questions where uncertainty matters most, and lists this as one of its main obstacles.
2. Uncertainty that can be trusted at scale
Hamiltonian Monte Carlo is the gold standard for the posterior, and it does not scale to large networks. Ensembles, Laplace approximations and variational inference do scale, and each can be overconfident or miscalibrated; this course showed it for variational inference (Chapter 9) and for deep ensembles (Chapter 14). Simulation-based calibration (Talts et al., 2018), coverage on benchmarks with known truth, and calibration on held-out environments are the tools for checking approximate posteriors; making them routine for large models, and cheap enough to run, is an open engineering and statistical problem.
3. Priors over worlds
Prior-fitted networks and amortised causal inference (Chapter 14) turn the choice of a prior into the design of a simulator. Their answers are posteriors under that simulator, and they degrade, sometimes silently, when real data come from outside it. How to design simulators that cover the worlds we will meet, how to detect that a real data set lies outside them, and how to report the dependence of the answer on the simulator, are questions that the wider field of simulation-based inference (Cranmer, Brehmer and Louppe, 2020) shares with causal AI.
4. Learning causal variables
Causal graphs are drawn over variables that someone has already defined: earnings, education, a treatment. Raw data, such as text, images or network traffic, do not come with such variables. Causal representation learning (Schölkopf et al., 2021) tries to learn them, and identifiability results show that this is possible only with extra structure, such as data from several environments or interventions, or auxiliary variables (Khemakhem et al., 2020). The HC3 environments of Chapter 14 were a small example: the artefact features were defined by hand, and a method that could find them unaided would be a real advance.
5. Transporting results to new populations
Most causal conclusions are needed for a population other than the one studied: a different city, a later year, a different university. Bareinboim and Pearl (2016) give graphical conditions for when an effect estimated in one population can be transported to another, and when data from several sources can be combined. Bayesian versions, which carry uncertainty about how far the populations differ, are much less developed, and are exactly what the EMS equity and AI-in-mathematics projects need when results from one setting are used to argue about another.
6. Language models as research assistants for causal inference
Language models know a great deal of causal background knowledge and reason poorly about novel causal structures (Chapter 14). Whether they can reliably help draw graphs, list confounders, find instruments and critique analysis plans, and how to evaluate that help without contaminated benchmarks, are open empirical questions. A careful study of this, with human experts as the comparison, would fit naturally into the AI-in-mathematics project.
7. Fairness as a causal question
Whether a decision is fair to a group usually means whether the group's membership causes a different decision through paths that should not exist. Counterfactual fairness (Kusner et al., 2017) makes this precise with a structural causal model. Applying such definitions to real systems, such as ambulance dispatch, requires the graph, its uncertainty and a sensitivity analysis: the whole workflow of this course, applied to a question where the stakes are high and the assumptions are contested.
Project Connections: Where to Go from Here
Each of the five projects can be read as an instance of one open problem. NYC EMS response equity is a transport and fairness problem: estimate direct effects of neighbourhood composition on response times, with the graph and the sensitivity analysis in the open. Cancer gene-expression subtypes is a representation-learning problem: find the variables, subtypes or pathways, that behave like causes of outcome and treatment response, and check that they are stable across cohorts. AI-generated text detection is a shortcut and invariance problem, with a moving target. AI tools in university mathematics is an observational causal study whose treatment changes every term, and a natural place to study language models as research assistants. Hostile-traffic detection is a problem of priors over worlds: attackers choose the world, so the detector must report when it is outside the range it was trained on.
A.8 From reading to research: where projects come from
Good applied projects rarely start from a method looking for data. They start from a question someone would act on, data that can actually be obtained, and a reason why a careful Bayesian analysis would change or sharpen the answer. Reading is the main source of all three. Six generators produce most publishable applied Bayesian projects, and every one of them has appeared in this course.
- Add the structure the original ignored. Repeated measures without a hierarchy, time series analysed as independent, a measurement error that was assumed away: a reanalysis with the right structure (Chapters 6–8) often changes the conclusion, and nearly always changes the uncertainty.
- Bring in what is already known. Where a literature says effects of this kind are small, an informative prior turns a noisy, dramatic estimate into a sober one (Section A.4). Dissection 1 is the template.
- Move a model to a new domain. The football model of Section A.6 is a model for pairwise competition with counts; the same structure describes chess, debating tournaments and pairwise comparisons of essays. Methods travel well, and many fields lack them.
- Put a design under a model. A natural experiment, a randomised replication or a multisection course with a common exam supplies identification (Chapter 13); the Bayesian model supplies partial pooling and honest uncertainty.
- Quantify the uncertainty in a computational or descriptive claim. Mathematics, physics and the humanities are full of claims based on large computations or corpora that are reported without intervals: average ranks of elliptic curves, stability of a quantum device, "six shapes" of stories. A model with an interval, and a check of how far the data can support an extrapolation, is often new.
- Replicate. A preregistered, well-powered Bayesian replication of a famous small study is publishable whatever it finds, and it is the most useful thing many fields need.
A project is ready to start when its skeleton fits on one page. The skeleton has the same headings for every project: the question and the estimand; why it is new; the data, with how to get them and any ethical approval needed; the DAG; the model, with priors that have been simulated; the checks that would convince a sceptic, ideally including one against known truth; the chapters of this course it draws on; the publishable result and a target venue; and the risks, with a fallback that is still worth reporting if the main analysis disappoints. The ten projects below are written in this form.
| Field | Venues that publish careful applied Bayesian work |
|---|---|
| Applied statistics, any field | Annals of Applied Statistics; Journal of the Royal Statistical Society, Series A and Series C; Bayesian Analysis; the Stan case-study series, for teaching-oriented work |
| Sports | Journal of Quantitative Analysis in Sports; Journal of Sports Analytics; the MIT Sloan Sports Analytics Conference; MathSport International |
| Education | Journal of Educational and Behavioral Statistics; Assessment & Evaluation in Higher Education; Studies in Educational Evaluation; Advances in Methods and Practices in Psychological Science (replications and registered reports) |
| Quantum computing | Quantum; PRX Quantum; npj Quantum Information; IEEE Transactions on Quantum Engineering and the IEEE Quantum Week conference |
| Mathematics | Experimental Mathematics; Mathematics of Computation; Research in Number Theory; for machine learning in mathematics, Machine Learning: Science and Technology |
| Literature and culture | Journal of Cultural Analytics; Digital Scholarship in the Humanities; the Computational Humanities Research conference; ACL workshops on narrative understanding |
Research Practice: From Project to Paper
- Write the one-page skeleton first, and keep it: it becomes the introduction, the methods section and, if the venue offers it, a preregistration or registered report.
- Run the whole pipeline on simulated data with known parameters before touching the real data (Chapter 5's parameter recovery); include the simulation study in the supplement.
- Decide on the main analysis, the checks and the sensitivity analyses before seeing the outcome data, and label everything else as exploratory.
- Structure the paper like Section A.3's table, and report what Chapter 13's checklist and the one in Section A.2 ask for: estimand, DAG, priors with prior predictive checks, diagnostics, posterior predictive and out-of-sample checks, sensitivity.
- Publish the code and, where permitted, the data, with a script that regenerates every number and figure, as this course does. For student data, obtain ethical (IRB) approval before collecting anything, and plan de-identification from the start.
- Negative and null results from a well-designed study are results. Say so in the skeleton, so that the project cannot fail.
A.9 Ten projects
The ten projects cover the fields you named: quantum computing, football, pure mathematics, education and literature. Each is sized for one to two semesters of part-time work by a strong student with a faculty adviser. Each uses data that are public or can be collected with approval, and each has a credible route to publication whatever the main result. The widget maps them onto the chapters of the course; the cards give the skeletons.
project 1 (quantum computing) — How stable is a quantum processor? A hierarchical state-space model of qubit noise
- Question
- How much do the error rates of individual qubits on today's superconducting processors drift from day to day, how much of the variation is shared across a device, and how much better would circuits run if qubits were chosen using predicted error rates, with uncertainty, rather than the latest calibration?
- Why it is new
- Device calibrations are reported as point values and used as if exact. A Bayesian time-series model gives forecasts with intervals, separates measurement noise from real drift and pools information across qubits; the qubit-selection question turns it into a decision problem with a measurable payoff.
- Data
- IBM publishes calibration data (T1 and T2 coherence times, gate and readout error rates) for its cloud devices, refreshed by regular characterisation runs; a free account and Qiskit retrieve them, including past calibrations, and the calibration data behind a published study of how the errors of four IBM devices changed over time (collected over 90 days) are archived on Zenodo (doi:10.5281/zenodo.4898393). For the decision experiment, run the same benchmark circuits on qubits chosen by each rule on a free-tier device.
- Model skeleton
- Log error rates for qubit on day : , with a device-level random walk or AR(1) shared component, qubit-level AR(1) deviations , qubit intercepts partially pooled by device, and a measurement-error term whose scale is informed by repeated calibrations within a day. Occasional recalibration jumps can be modelled as a mixture of normal and heavy-tailed innovations.
- Checks
- One-day-ahead forecast calibration (do 90% intervals contain 90% of next-day values?) against persistence (tomorrow = today) and moving averages; posterior predictive checks of autocorrelation; a randomised comparison of qubit-selection rules on the fidelity of benchmark circuits (Chapter 13).
- Chapters
- 4 (models for rates), 5 (diagnostics), 6 (pooling across qubits and devices), 7 (measurement error, gaps in the record), 8 (state-space models and forecasting), 11 (copulas for the residuals: do qubits on one device have bad days together?), 13 (the randomised decision experiment).
- Publishable result
- Forecast intervals for device noise with demonstrated calibration, and an estimate of how much uncertainty-aware qubit selection improves circuit fidelity: suitable for IEEE Transactions on Quantum Engineering or the IEEE Quantum Week conference.
- Risks and fallback
- Devices are retired and access policies change, so archive everything you download. If the decision experiment shows no gain, the forecasting comparison is still a result. A related Bayesian thread to read first is sequential Monte Carlo for learning device parameters (Granade et al., 2012).
project 2 (football) — Is finishing a skill? Partial pooling of players' goals above expected
- Question
- Expected-goals (xG) models give each shot a probability of scoring from its location and context. Do some players consistently score more than their shots' xG predicts, and how much of a striker's apparent over-performance in one season survives into the next?
- Why it is new
- "Goals minus xG" is widely quoted for single seasons and usually treated as skill. A hierarchical model estimates the between-player spread of finishing skill with honest uncertainty, and the season-to-season check measures how much of the raw number is noise: a Type M problem in disguise.
- Data
- StatsBomb's open data on GitHub: event data for every shot, with StatsBomb's own xG and the positions of nearby players, for several complete competitions (men's and women's). Use their xG as an offset, or fit your own shot model as a check.
- Model skeleton
- For shot by player : , , with or a horseshoe prior if most players are average; extend with player-season effects to measure persistence.
- DAG
- Skill affects both shot selection and conversion, so "goals above xG" conditions on a post-treatment variable (shot quality); state this, and estimate the skill that operates given the shot.
- Checks
- Prior predictive simulation of season totals; posterior predictive checks of the distribution of goals minus xG across players; out-of-sample prediction of next-season conversion against the raw over-performance and against xG alone; calibration of the xG offset itself.
- Chapters
- 2 (priors), 4 (logistic regression with an offset), 6 (partial pooling), 7 (measurement error in xG), 10 (sparse shrinkage), 12 (calibration).
- Publishable result
- An estimate of the spread of finishing skill, with the number of shots needed before a player's record is more signal than noise: Journal of Quantitative Analysis in Sports or the Sloan conference.
- Risks and fallback
- Open data cover selected competitions and seasons, so samples per player are small; that is the point of the hierarchy, and a finding that skill is small and hard to detect is itself publishable.
project 3 (football) — Does sacking the manager work? A Bayesian causal analysis with regression to the mean
- Question
- What is the effect of an in-season managerial dismissal on a team's subsequent results, compared with what similar teams that kept their manager went on to do?
- Why it is new
- Teams improve after sackings, but sackings follow bad runs, and bad runs regress to the mean. Van Ours and van Tuijl (2016) used 14 Dutch seasons and found that teams that kept their coach after similar slumps improved as much. A Bayesian version across several leagues, with team strength modelled as a latent time series and the effect allowed to vary by league and timing, gives an effect estimate with honest uncertainty and a sensitivity analysis.
- Data
- Match results for many leagues and seasons from the openfootball project (GitHub, as in Section A.6); dismissal dates compiled from public club histories, double-checked against a second source.
- Model skeleton
- Stage 1: a dynamic version of Section A.6's model, in which each team's attack and defence follow random walks across rounds (Chapter 8). Stage 2: for each dismissal, matched control teams with a comparable slump and comparable latent strength at the same point of the season (Chapter 13); the effect is the difference in posterior expected points over the next ten matches, pooled hierarchically across leagues.
- Checks
- Placebo "dismissals" at random slump points in teams that did not sack; overlap of the latent strengths of treated and control teams; sensitivity to the length of the outcome window and to unmeasured confounders such as injuries.
- Chapters
- 4 (Poisson models), 6 (pooling across leagues), 8 (latent strength over time), 13 (matching, placebo tests and sensitivity analysis).
- Publishable result
- A multi-league estimate of the effect of sacking, with its uncertainty: Journal of Sports Analytics or Journal of Quantitative Analysis in Sports; the method transfers to other "intervene after a slump" decisions.
- Risks and fallback
- Compiling dismissal dates is laborious; start with two leagues. A replication of van Ours and van Tuijl's null finding in other leagues is still a contribution.
project 4 (number theory) — Where is the average rank of elliptic curves going? Bayesian extrapolation of arithmetic statistics
- Question
- The "minimalist" conjecture says that, ordered by size, half of all elliptic curves over the rationals have rank 0 and half rank 1, so the average rank tends to 1/2. In large databases the average is much higher and was long seen to rise (Bektemirov, Mazur, Stein and Watkins, 2007); in a later database of nearly 239 million curves ordered by height, the average rank rises up to a certain height and then eventually decreases, while still being far above 1/2 (Balakrishnan et al., 2016). What do the data say about how fast, if at all, the average approaches 1/2, and how far can they support any extrapolation?
- Why it is new
- Number theorists reason about these data with plots and heuristics. A Bayesian model of the rank distribution as a function of height, with competing asymptotic forms (convergence to 1/2 at various rates, or to another limit) compared by out-of-sample prediction on the largest heights, puts intervals on the extrapolation and says how much larger a database would need to be to discriminate between them.
- Data
- Cremona's tables of elliptic curves ordered by conductor (on GitHub, with ranks), the LMFDB, and the height-ordered database of Balakrishnan et al. (2016), whose summary statistics by height range are published with the paper.
- Model skeleton
- For curves in height bin : counts of ranks 0, 1, 2 and higher are , with a smooth function of . Root-number parity splits curves into even and odd rank, so model and as decaying functions of with priors informed by random-matrix heuristics. Compare forms by leave-future-out validation on the largest heights.
- Checks
- Posterior predictive checks of the rank proportions by bin; agreement with the 2-Selmer statistics, whose predicted limits (Poonen–Rains, Bhargava–Shankar) give a second, checkable target; prior sensitivity, since the extrapolation is where the prior matters most.
- Chapters
- 2 (priors from heuristics), 4 (multinomial and binomial models), 8 (smooth trends in ; leave-future-out validation), 9 (fast approximate fitting across many bins), 10 (model comparison).
- Publishable result
- A quantified statement of the tension between data and conjecture, with intervals, and a calculation of the database size needed to resolve it: Experimental Mathematics or Research in Number Theory.
- Risks and fallback
- The extrapolation may be uninformative; that is a result if stated quantitatively. The same machinery applies to murmurations (He, Lee, Oliver and Pozdnyakov, 2024), the oscillating averages of Frobenius traces found by machine learning, where a Bayesian functional model could estimate the oscillation's shape with uncertainty.
project 5 (algebraic geometry) — Knowing when not to trust a learned invariant: Bayesian dimension estimates for Fano varieties
- Question
- Coates, Kasprzyk and Veneziale (2023) trained classifiers to recover the dimension of a toric Fano variety from the growth of the coefficients of its quantum period, with about 98% accuracy. For mathematical use, the important question is the other 2%: can a model say which predictions to trust, and does it know when a new variety is unlike its training data?
- Why it is new
- Machine learning is increasingly used to suggest conjectures, and point predictions without calibrated uncertainty are a weak basis for them. An explicitly Bayesian model of the coefficient asymptotics gives a posterior over the dimension and a principled reason to abstain.
- Data
- Generate your own: for weighted projective spaces the period sequence has a closed form (a ratio of factorials in the weights), so tens of thousands of examples can be generated in R, with exact dimensions; toric varieties of Picard rank two follow from the formulae in the paper.
- Model skeleton
- For each variety, the log coefficients grow approximately like , with determined by the dimension. Fit the asymptotic regression with a Bayesian model that includes the curvature at small (Chapter 3), giving a posterior for ; the posterior probability of each dimension follows. Compare with a calibrated classifier (Chapters 10, 12) and with a prior-fitted network trained on simulated sequences (Chapter 14).
- Checks
- Calibration of the posterior probabilities on held-out varieties; deliberate shift tests (train on small weights, test on large); coverage of intervals for against the exact value; the accuracy achievable when the model abstains on its least certain 5%.
- Chapters
- 3 (asymptotic regression), 5 (diagnostics), 10 (classification and shrinkage), 12 (calibration), 14 (prior-fitted networks, shortcuts and distribution shift).
- Publishable result
- Calibrated uncertainty and abstention for a published machine-learned invariant, a general template for "AI-assisted mathematics" claims: Experimental Mathematics or Machine Learning: Science and Technology.
- Risks and fallback
- Reproducing the data generation takes care; start with weighted projective spaces, where the formula is explicit and the published accuracy is near perfect, so any failure of calibration is easy to see.
project 6 (education) — What do student evaluations measure? A multilevel measurement model with a bias audit
- Question
- How much of the variation in student evaluation of teaching (SET) ratings is attributable to the instructor rather than to the course, the term, the class size and the students' expected grades, and do ratings differ by instructor gender or other characteristics once these are accounted for?
- Why it is new
- SETs drive hiring and promotion, and are usually summarised as raw means. A crossed multilevel ordinal model separates instructor, course and term variance; a measurement-invariance analysis asks whether the items mean the same thing for different instructors; and linking to a common final exam in multisection courses tests whether ratings track learning (dissection 4).
- Data
- Your institution's SET responses and grade records, de-identified, with ethical approval and the agreement of the faculty union where required; the published data of Boring, Ottoboni and Stark (2016) for a reanalysis and replication.
- Model skeleton
- Item responses on a 1–5 scale: a cumulative-logit (ordinal) model with crossed random effects for instructor, course and term, and student-level covariates such as expected grade; a latent factor for "teaching quality" with item loadings allowed to differ by instructor group (Chapter 11); for multisection courses, a second equation linking the instructor effect on ratings to the instructor effect on exam scores (Chapter 13).
- Checks
- Posterior predictive checks of rating distributions by item; leave-one-term-out prediction; sensitivity to nonresponse (response rates are often low and selective, Chapter 7); identical analyses on a randomised source where possible (MacNell, Driscoll and Hunt, 2015).
- Chapters
- 4 (ordinal models), 6 (crossed random effects), 7 (nonresponse), 11 (factor models and invariance; the Gaussian copula for correlating Likert items with grades and class sizes), 13 (bias as a causal question).
- Publishable result
- A variance decomposition and bias audit with honest intervals, and policy-relevant guidance on how many evaluations are needed before an instructor's mean is informative: Assessment & Evaluation in Higher Education or Journal of Educational and Behavioral Statistics.
- Risks and fallback
- Access and ethics take time; start the approval process first. The reanalysis of published data is a complete paper on its own.
project 7 (education) — Writing about exam worries: a preregistered Bayesian replication in university mathematics
- Question
- Does ten minutes of expressive writing about exam worries just before a mathematics exam improve performance, especially for students with high test anxiety?
- Why it is new
- Ramirez and Beilock (2011) reported large benefits in a Science paper; a large-scale replication in the Social Sciences Replication Project (Camerer et al., 2018) did not find a significant effect in the same direction. A preregistered, randomised Bayesian replication in university mathematics courses, with a prior built from both, is publishable whatever it finds, and directly useful to instructors.
- Data
- Collected by you, with ethical approval: students in several sections randomised within section to expressive writing or a neutral writing control before a midterm; a validated test-anxiety questionnaire beforehand, such as the Cognitive Test Anxiety Scale (Cassady and Johnson, 2002); prior grades as a pre-treatment covariate.
- Model skeleton
- Exam score (standardised) , with section effects partially pooled, anxiety measured as a latent factor from the questionnaire items (Chapter 11), and a sceptical prior on informed by the replication literature; heterogeneous effects with BART as a secondary analysis (Chapter 13).
- Checks
- A design analysis before data collection (Section A.4: the retrodesign function) to choose the number of students; prior sensitivity, reporting the posterior under the original study's effect size, a sceptical prior and a flat prior; missing exam scores handled with the mechanism made explicit (Chapter 7).
- Chapters
- 1 (design and workflow), 2 (priors from earlier studies), 6 (sections), 7 (missing outcomes), 11 (anxiety as a latent factor; a Gaussian copula factor model for the ordinal questionnaire items), 13 (randomisation, heterogeneity, mediation through reported worry).
- Publishable result
- A registered report in Advances in Methods and Practices in Psychological Science or a replication in an education journal; the anxiety-measurement component connects to the AI-in-mathematics project.
- Risks and fallback
- Sample size per term may be modest; the Bayesian analysis can accumulate across terms with the protocol fixed in advance.
project 8 (literature) — Are there really six shapes of stories? A Bayesian functional mixture of emotional arcs
- Question
- Reagan et al. (2016) scored the sentiment of 1,327 Project Gutenberg novels along their length and reported that the resulting "emotional arcs" are dominated by six basic shapes, such as rags to riches, tragedy and man in a hole. How many shapes do the data support, and how many books are mixtures rather than members of a type?
- Why it is new
- The original analysis used singular value decomposition, clustering and self-organising maps, without a likelihood or uncertainty. A Bayesian functional mixture model, with each arc a smooth curve drawn from one of shape-specific Gaussian processes, chooses by predictive performance and gives each book a posterior over shapes.
- Data
- Project Gutenberg texts (public domain); a sentiment lexicon applied to sliding windows, as in the original, plus a modern sentiment model as a check on measurement.
- Model skeleton
- For book , window sentiment on a normalised time axis ; given its cluster ; cluster means smooth curves; . Fit with a basis-function approximation to the GP (Chapter 8) and compare by cross-validated predictive density (Chapter 11).
- Checks
- A simulation study with known shapes; posterior predictive checks of arc variability; stability across sentiment lexicons, window lengths and random halves of the corpus; whether the shapes predict anything external, such as downloads or genre.
- Chapters
- 8 (Gaussian processes), 9 (variational inference for speed), 11 (mixtures and choosing ), 12 (text as data).
- Feasibility check
A first pass takes an hour. Six public-domain novels from Project Gutenberg are split into 50 windows each, every word is scored with the Bing sentiment lexicon of Hu and Liu (2004) distributed with the tidytext package (Silge and Robinson, 2016), and each window's sentiment is the share of positive minus the share of negative scored words. A Bayesian smoothing spline for each book, with its own noise level, gives the arc with its uncertainty.
Rlibrary(tidytext) books <- c(`Pride and Prejudice` = 1342, Frankenstein = 84, Dracula = 345, `Alice in Wonderland` = 11, `A Christmas Carol` = 46, `Moby-Dick` = 2701) read_gut <- function(id) { # the text between Project Gutenberg's start and end markers x <- readLines(sprintf("https://www.gutenberg.org/cache/epub/%d/pg%d.txt", id, id), encoding = "UTF-8", warn = FALSE) x[(grep("\\*\\*\\* ?START OF", x)[1] + 1):(grep("\\*\\*\\* ?END OF", x)[1] - 1)] } arcs <- imap_dfr(books, function(id, title) tibble(book = title, text = read_gut(id))) |> unnest_tokens(word, text) |> group_by(book) |> mutate(t = (row_number() - 0.5) / n()) |> ungroup() |> inner_join(get_sentiments("bing"), by = "word", relationship = "many-to-many") |> mutate(window = pmin(floor(t * 50), 49)) |> group_by(book, window) |> summarise(t = (first(window) + 0.5) / 50, sentiment = mean(sentiment == "positive") - mean(sentiment == "negative"), scored_words = n(), .groups = "drop") m_arcs <- brm(bf(sentiment ~ book + s(t, by = book, k = 8), sigma ~ book), data = arcs, seed = 8, refresh = 0, control = list(adapt_delta = 0.95), file = "fits/aw_arcs") ends <- expand_grid(book = names(books), t = c(0.05, 0.95)) e <- posterior_epred(m_arcs, newdata = ends) # draws x (book, t) tibble(book = names(books), start = colMeans(e[, c(TRUE, FALSE)]), end = colMeans(e[, c(FALSE, TRUE)]), p_ending_happier = colMeans(e[, c(FALSE, TRUE)] > e[, c(TRUE, FALSE)])) |> mutate(across(where(is.double), ~ round(.x, 3))) |> as.data.frame()outputbook start end p_ending_happier 1 Pride and Prejudice 0.191 0.145 0.277 2 Frankenstein 0.148 -0.301 0.000 3 Dracula -0.039 -0.098 0.186 4 Alice in Wonderland 0.006 -0.148 0.089 5 A Christmas Carol -0.044 0.332 0.998 6 Moby-Dick -0.042 -0.136 0.074Rfit_arcs <- expand_grid(book = names(books), t = seq(0.01, 0.99, length.out = 60)) f <- posterior_epred(m_arcs, newdata = fit_arcs) fit_arcs |> mutate(est = colMeans(f), lo = apply(f, 2, quantile, 0.05), hi = apply(f, 2, quantile, 0.95)) |> ggplot(aes(t, est)) + geom_hline(yintercept = 0, colour = harbour[["grid"]]) + geom_ribbon(aes(ymin = lo, ymax = hi), fill = harbour[["sky"]], alpha = 0.25) + geom_point(data = arcs, aes(y = sentiment), size = 0.7, colour = harbour[["muted"]]) + geom_line(colour = harbour[["sky"]], linewidth = 0.9) + facet_wrap(~ book, ncol = 3) + scale_x_continuous(breaks = c(0.05, 0.5, 0.95), labels = c("start", "middle", "end")) + theme(panel.spacing.x = unit(1.2, "lines")) + labs(x = NULL, y = "net sentiment")Sentiment arcs of six novels: the share of positive minus negative sentiment words in each fiftieth of the text (points) and a Bayesian smoothing spline for each book (line, with 90% interval). Time runs from the first word to the last. The arcs are recognisable but noisy. A Christmas Carol is the clearest rise: from about −0.04 near the start to +0.33 at the end, and the posterior probability that its ending is happier than its opening is 0.998, with a dip and recovery in the middle, close to the "man in a hole" and "Cinderella" shapes. Frankenstein is the clearest fall (+0.15 to −0.30; probability of a happier ending 0.000), a tragedy. The others are much flatter: Pride and Prejudice stays positive throughout, and Dracula, Moby-Dick and Alice in Wonderland drift gently downward, with probabilities of a happier ending between 0.07 and 0.28. Two lessons for the project follow. Most books are not cleanly one of six shapes; and a window of a few dozen to a few hundred sentiment words measures tone with a standard error comparable to the arcs' own rise and fall, so the measurement model (lexicon, window length, the noise level estimated for each book) matters as much as the clustering model. Both are good reasons for the Bayesian treatment the project proposes.
- Publishable result
- A probabilistic reanalysis of a widely cited claim: Journal of Cultural Analytics or the Computational Humanities Research conference. If the answer is "far fewer than six" or "a continuum rather than types", that is the headline.
- Risks and fallback
- Sentiment lexicons measure tone imperfectly, especially in older prose; treat measurement as part of the model and report its sensitivity.
project 9 (AI and creative writing) — Does AI narrow fiction? Measuring the diversity of themes in human and machine stories
- Question
- When people write stories with help from a language model, or models write them alone, is the collection of stories less diverse in its themes than stories written by people from the same prompts, and which themes are over- and under-represented?
- Why it is new
- Doshi and Hauser (2024) found in an experiment that access to AI ideas made individual stories rated more creative but made the stories more similar to each other. A Bayesian topic model with explicit diversity measures, prompts as a random effect and the author type as the treatment, can locate where the narrowing happens and how large it is, with intervals.
- Data
- Human stories written to the same prompts, from the public WritingPrompts collection (Fan, Lewis and Dauphin, 2018) or from Doshi and Hauser's published data; stories generated by several models from the same prompts, with settings recorded; optionally a small writing experiment with students, with ethical approval.
- Model skeleton
- An LDA or Dirichlet-multinomial topic model (Chapter 12) with document-topic proportions depending on author type and prompt through a hierarchical logistic-normal prior; diversity as the expected entropy of the collection's topic distribution and the expected distance between stories from the same prompt, both as posterior quantities.
- Checks
- Shortcut checks (Chapter 14): length, formatting and stock phrases differ between human and model text and must not drive the topics; robustness to the number of topics and to the choice of models; human rating of a sample of topics for interpretability.
- Chapters
- 6 (prompts as random effects), 11 (mixtures and latent structure), 12 (topic models), 13 (author type as a treatment in a designed comparison), 14 (shortcuts and invariance).
- Publishable result
- A quantitative map of thematic narrowing: Journal of Cultural Analytics, an ACL workshop, or a general-interest venue if the effect is large and well identified.
- Risks and fallback
- Models change quickly; record versions and dates, and frame results as a measurement protocol others can rerun.
project 10 (classics) — Who wrote which scene? Bayesian change-point attribution of a collaborative play
- Question
- Shakespeare's Henry VIII is generally believed to be a collaboration with John Fletcher. Plecháč (2021) used frequent words and rhythmic patterns with a classifier on rolling windows to locate the boundaries between the authors' shares, which need not coincide with scene boundaries. Can a Bayesian model give each passage a posterior probability of authorship, find the change points with intervals, and say where the evidence is genuinely ambiguous?
- Why it is new
- Stylometric attributions usually report classifier scores without calibrated probabilities. A hidden Markov model, whose hidden state is the author and whose emissions are Dirichlet-multinomial counts of function words and metrical features, gives exactly that, and extends the Bayesian authorship tradition of Mosteller and Wallace (Chapter 12).
- Data
- Public-domain texts of the plays of both authors (for training) and of Henry VIII (and other suspected collaborations, such as The Two Noble Kinsmen), from Project Gutenberg or the Folger editions.
- Model skeleton
- Texts divided into windows of fixed length; author-specific Dirichlet-multinomial distributions over the most frequent words, with hierarchical priors pooling plays by the same author; a two-state hidden Markov model along the play with a sticky transition matrix, so that authorship changes rarely; posterior probabilities from the forward–backward algorithm, inside Stan.
- Checks
- Leave-one-play-out validation on single-author plays, including artificial "collaborations" spliced from two known plays, so that the change-point accuracy is measured against known truth; calibration of the posterior probabilities; invariance to genre and date (Chapter 14), since late plays differ from early ones for reasons other than authorship.
- Chapters
- 8 (hidden Markov and change-point models), 10 (shrinkage over many words), 11 (latent states), 12 (Dirichlet-multinomial text models, calibration), 14 (invariance to genre).
- Publishable result
- Calibrated scene-by-scene attribution with uncertainty, validated on spliced texts: Digital Scholarship in the Humanities or the Computational Humanities Research conference.
- Risks and fallback
- Revision and collaboration may be finer-grained than any model can resolve; the spliced-text validation shows the resolution limit, which is itself a useful, publishable result.
Key Takeaways: Reading and Research
- An applied Bayesian paper is a claim about the world backed by a model and checks. Read the figures and the model first, and write the claim as "under A, data D imply Q is about X (interval I), which matters because Y".
- Eight questions (estimand, data, structure, priors, computation, fit and prediction, size and certainty, sensitivity) catch most weak papers.
- Type S and Type M errors: significant results from noisy studies of small effects are exaggerated and often of the wrong sign; a prior that encodes known effect sizes corrects them.
- Reproduce before you extend: the hierarchical football model, refitted on a new season, beat a no-skill baseline out of sample and showed the overshrinkage its authors reported, but lost clearly to the betting market, the benchmark that matters.
- Projects come from adding ignored structure, using what is known, moving models across fields, putting designs under models, quantifying uncertainty in computational claims, and replicating. Write the one-page skeleton first.
A.10 A last word
George Box wrote that "since all models are wrong the scientist cannot obtain a 'correct' one by excessive elaboration" (Box, 1976). The course has tried to take both halves of that sentence seriously. Models are wrong, so we check them against data, against benchmarks with known truth and against data from elsewhere, and we say how the answer depends on what we could not check. And elaboration is not the cure, so a neural network with a million weights is no substitute for a graph drawn with care. The tools will keep changing; the questions of what we want to know, what we are willing to assume, and how we would find out that we were wrong will not.
A.11 Exercises
Each exercise has a hint and an answer button.
Exercises
Design before data. Project 7 plans to randomise 200 students (100 per arm) to expressive writing or a control, with exam scores standardised to standard deviation 1. If the true effect is 0.1 standard deviations, what are the power, the Type S error rate and the exaggeration ratio? How many students per arm would give 80% power?
The standard error of a difference of two means with 100 per arm is . Use
retrodesign()from Section A.4; for the sample size, solve .The standard error of the difference is . With a true effect of 0.1, the power is about 11%; a significant result would have the wrong sign 3.5% of the time and would exaggerate the true effect about 3.4-fold on average. For 80% power, requires , that is students per arm. No single course can supply that, which is why Project 7 accumulates students across sections and terms with a fixed protocol, uses prior grades as a covariate to reduce the standard error, and reports a posterior rather than a significance test: a well-designed Bayesian analysis of 200 students is informative evidence to combine with other studies, even though it cannot settle the question alone.
Without the hierarchy. Refit the football model of Section A.6 with fixed team effects (attack and defence as factors, each coefficient with a Normal(0, 1) prior) instead of partially pooled ones. Compare its out-of-sample log score and Brier score on the last ten rounds with the hierarchical model's.
goals ~ 1 + home + attack + defencewithprior(normal(0, 1), class = b); reuselog_score(),outcome_probs()andbrier().Out of sample the two models are nearly indistinguishable: log score −313.1 for fixed team effects against −312.3 for the hierarchical model (difference 0.8, standard error 1.5), and Brier scores of 0.557 and 0.562. After 28 matches per team, each team's own record is informative enough that partial pooling changes the predictions little, and the overshrinkage of the hierarchical model and the noise of the unpooled one roughly cancel. Pooling matters most when data per team are scarce: refit both models on the first five or ten rounds and the hierarchical model's advantage becomes clear. The lesson for reading papers is that "the hierarchical model is better" is a claim about a particular amount of data, and should be checked rather than assumed.
Overshrinkage at the top. Manchester City won the 2023–24 title with 91 points. Using the simulations of Section A.6, what posterior predictive probability did the model give to City reaching 91 points or more? What does this say about the model, and how would Baio and Blangiardo's mixture prior, or strengths that change over the season, address it?
The row of
simfor Manchester City holds its simulated final points.The model gave City only about a 1.2% chance of reaching 91 points (its simulated mean was about 81.5 and its 95th percentile 88). City took 28 of the 30 points available in the last ten rounds. Some of that is luck that no model should predict, but the prior also shrank City's attack and defence toward the league average, so the model underrated the best team's chance of a near-perfect run: the overshrinkage Baio and Blangiardo reported. Their mixture prior puts the strongest teams in their own group with its own mean, so they are shrunk toward other strong teams rather than toward the middle. Letting strengths evolve over the season (a random walk, Chapter 8) would also weight City's strong recent form more heavily. Either extension should be judged on the same out-of-sample scores, not on whether it happens to get City right.
Dissecting a famous study. Apply the four-part dissection of Section A.5 to Ramirez and Beilock (2011), "Writing about testing worries boosts exam performance in the classroom". You may work from the abstract and figures.
What was compared with what, in how many people? What would the retrodesign of Section A.4 say? What happened in the replication?
Example. Claim. Writing for ten minutes about one's worries immediately before a high-stakes test improves performance, especially for students with high test anxiety. Key evidence. Two laboratory experiments with university students under induced pressure, and two field studies with ninth-grade biology students writing before their final exam; in the laboratory, writing prevented the drop in performance under pressure seen in controls, and in the classroom, highly anxious students who wrote about their worries scored higher than highly anxious controls. The check that matters. The samples were small and the effects large for a ten-minute intervention, the situation in which Section A.4 predicts exaggeration; the key comparisons are interactions within subgroups, which are noisier still. A large replication in the Social Sciences Replication Project (Camerer et al., 2018) did not find a significant effect in the original direction. What it does not show. That the intervention does nothing: a small benefit for highly anxious students remains plausible, and the original experiments were randomised, so the direction of the comparison is sound. What is needed is a well-powered study with a prior that reflects both the original and the replication, which is Project 7.
Further reading and references
Further Reading
- McElreath, Statistical Rethinking: A Bayesian Course with Examples in R and Stan, 2nd edition (CRC Press, 2020): the closest companion to this course, with the same emphasis on graphs and simulation.
- Gelman et al., "Bayesian workflow" (arXiv:2011.01808, 2020): the loop of this afterword in detail, with many worked examples.
- Hernán and Robins, Causal Inference: What If (Chapman & Hall/CRC, 2020; free online): for the causal half, especially target trials.
- Gelman, Hill and Vehtari, Regression and Other Stories (Cambridge, 2020; free online): applied regression read through the questions of Section A.4, with many reanalyses of published studies.
- Gelman and Loken, "The statistical crisis in science" (American Scientist, 2014): the garden of forking paths in six pages.
- Murphy, Probabilistic Machine Learning: Advanced Topics (MIT Press, 2023; free online): where Bayesian inference meets modern machine learning.
- Baio, G. and Blangiardo, M. (2010). Bayesian hierarchical model for the prediction of football results. Journal of Applied Statistics, 37(2), 253–264.
- Balakrishnan, J. S., Ho, W., Kaplan, N., Spicer, S., Stein, W. and Weigandt, J. (2016). Databases of elliptic curves ordered by height and distributions of Selmer groups and ranks. LMS Journal of Computation and Mathematics, 19(A), 351–370.
- Bareinboim, E. and Pearl, J. (2016). Causal inference and the data-fusion problem. Proceedings of the National Academy of Sciences, 113(27), 7345–7352.
- Bektemirov, B., Mazur, B., Stein, W. and Watkins, M. (2007). Average ranks of elliptic curves: tension between data and conjecture. Bulletin of the American Mathematical Society, 44(2), 233–254.
- Bem, D. J. (2011). Feeling the future: experimental evidence for anomalous retroactive influences on cognition and affect. Journal of Personality and Social Psychology, 100(3), 407–425.
- Boring, A., Ottoboni, K. and Stark, P. B. (2016). Student evaluations of teaching (mostly) do not measure teaching effectiveness. ScienceOpen Research, doi:10.14293/S2199-1006.1.SOR-EDU.AETBZC.v1.
- Box, G. E. P. (1976). Science and statistics. Journal of the American Statistical Association, 71(356), 791–799.
- Camerer, C. F., Dreber, A., Holzmeister, F. et al. (2018). Evaluating the replicability of social science experiments in Nature and Science between 2010 and 2015. Nature Human Behaviour, 2, 637–644.
- Cassady, J. C. and Johnson, R. E. (2002). Cognitive test anxiety and academic performance. Contemporary Educational Psychology, 27(2), 270–295.
- Coates, T., Kasprzyk, A. M. and Veneziale, S. (2023). Machine learning the dimension of a Fano variety. Nature Communications, 14, 5526.
- Cranmer, K., Brehmer, J. and Louppe, G. (2020). The frontier of simulation-based inference. Proceedings of the National Academy of Sciences, 117(48), 30055–30062.
- Dixon, M. J. and Coles, S. G. (1997). Modelling association football scores and inefficiencies in the football betting market. Journal of the Royal Statistical Society, Series C, 46(2), 265–280.
- Doshi, A. R. and Hauser, O. P. (2024). Generative AI enhances individual creativity but reduces the collective diversity of novel content. Science Advances, 10(28), eadn5290.
- Fan, A., Lewis, M. and Dauphin, Y. (2018). Hierarchical neural story generation. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, 889–898.
- Fortuin, V. (2022). Priors in Bayesian deep learning: a review. International Statistical Review, 90(3), 563–591.
- Gelman, A. and Carlin, J. (2014). Beyond power calculations: assessing Type S (sign) and Type M (magnitude) errors. Perspectives on Psychological Science, 9(6), 641–651.
- Gelman, A. and Loken, E. (2014). The statistical crisis in science. American Scientist, 102(6), 460–465.
- Gelman, A. and Weakliem, D. (2009). Of beauty, sex and power. American Scientist, 97(4), 310–316.
- Gelman, A., Vehtari, A., Simpson, D., Margossian, C. C., Carpenter, B., Yao, Y., Kennedy, L., Gabry, J., Bürkner, P.-C. and Modrák, M. (2020). Bayesian workflow. arXiv:2011.01808.
- Granade, C. E., Ferrie, C., Wiebe, N. and Cory, D. G. (2012). Robust online Hamiltonian learning. New Journal of Physics, 14, 103013.
- He, Y.-H., Lee, K.-H., Oliver, T. and Pozdnyakov, A. (2024). Murmurations of elliptic curves. Experimental Mathematics, doi:10.1080/10586458.2024.2382361.
- Hu, M. and Liu, B. (2004). Mining and summarizing customer reviews. Proceedings of the 10th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 168–177.
- Ioannidis, J. P. A. (2005). Why most published research findings are false. PLoS Medicine, 2(8), e124.
- Kanazawa, S. (2007). Beautiful parents have more daughters: a further implication of the generalized Trivers–Willard hypothesis. Journal of Theoretical Biology, 244(1), 133–140.
- Khemakhem, I., Kingma, D. P., Monti, R. P. and Hyvärinen, A. (2020). Variational autoencoders and nonlinear ICA: a unifying framework. Proceedings of the 23rd International Conference on Artificial Intelligence and Statistics, 2207–2217.
- Kusner, M. J., Loftus, J., Russell, C. and Silva, R. (2017). Counterfactual fairness. Advances in Neural Information Processing Systems, 30.
- Lundberg, I., Johnson, R. and Stewart, B. M. (2021). What is your estimand? Defining the target quantity connects statistical evidence to theory. American Sociological Review, 86(3), 532–565.
- MacNell, L., Driscoll, A. and Hunt, A. N. (2015). What's in a name: exposing gender bias in student ratings of teaching. Innovative Higher Education, 40(4), 291–303.
- Maher, M. J. (1982). Modelling association football scores. Statistica Neerlandica, 36(3), 109–118.
- Open Science Collaboration (2015). Estimating the reproducibility of psychological science. Science, 349(6251), aac4716.
- van Ours, J. C. and van Tuijl, M. A. (2016). In-season head-coach dismissals and the performance of professional football teams. Economic Inquiry, 54(1), 591–604.
- Papamarkou, T. et al. (2024). Position: Bayesian deep learning is needed in the age of large-scale AI. Proceedings of the 41st International Conference on Machine Learning, 39556–39586.
- Plecháč, P. (2021). Relative contributions of Shakespeare and Fletcher in Henry VIII: an analysis based on most frequent words and most frequent rhythmic patterns. Digital Scholarship in the Humanities, 36(2), 430–438.
- Ramirez, G. and Beilock, S. L. (2011). Writing about testing worries boosts exam performance in the classroom. Science, 331(6014), 211–213.
- Reagan, A. J., Mitchell, L., Kiley, D., Danforth, C. M. and Dodds, P. S. (2016). The emotional arcs of stories are dominated by six basic shapes. EPJ Data Science, 5, 31.
- Schölkopf, B., Locatello, F., Bauer, S., Ke, N. R., Kalchbrenner, N., Goyal, A. and Bengio, Y. (2021). Toward causal representation learning. Proceedings of the IEEE, 109(5), 612–634.
- Silge, J. and Robinson, D. (2016). tidytext: text mining and analysis using tidy data principles in R. Journal of Open Source Software, 1(3), 37.
- Simmons, J. P., Nelson, L. D. and Simonsohn, U. (2011). False-positive psychology: undisclosed flexibility in data collection and analysis allows presenting anything as significant. Psychological Science, 22(11), 1359–1366.
- Talts, S., Betancourt, M., Simpson, D., Vehtari, A. and Gelman, A. (2018). Validating Bayesian inference algorithms with simulation-based calibration. arXiv:1804.06788.
- Uttl, B., White, C. A. and Wong Gonzalez, D. (2017). Meta-analysis of faculty's teaching effectiveness: student evaluation of teaching ratings and student learning are not related. Studies in Educational Evaluation, 54, 22–42.
- Wang, W., Rothschild, D., Goel, S. and Gelman, A. (2015). Forecasting elections with non-representative polls. International Journal of Forecasting, 31(3), 980–991.