Berry (1996) pro putting data; Broadie's modern PGA data
Skills
Binomial likelihoods · building a likelihood from a mechanistic model · prior predictive checks · LOO model comparison · diagnosing a sampler that refuses to mix · model expansion
A golf analytics company wants a model for the probability that a professional sinks a putt
as a function of distance. It will feed a "strokes gained" product, so it has to
extrapolate sensibly and its parameters should mean something to a coach.
You get two datasets: a small classic one (19 distances, ~5,600 putts) and a modern one
with 30x more putts. A model that looks great on the first will break on the second.
Your job is to find out why and fix it.
golf: Putts attempted and made by distance (feet), 19 distances.
source: Berry (1996), professional golf putting; used in Gelman & Nolan (2002).
url: https://raw.githubusercontent.com/stan-dev/example-models/master/knitr/golf/golf_data.txt
x
n
y
0
2
1443
1346
1
3
694
577
2
4
455
337
3
5
353
208
4
6
272
149
Two physical constants you will need later (both in feet, like x):
Plot the empirical success rate against distance with an uncertainty interval for each
point. Which distances are measured precisely, and which are not?
A putt goes in if the ball's centre passes over the hole. Suppose the golfer aims at the
centre but the launch angle is off by a random error $\theta \sim \text{Normal}(0, \sigma)$.
Deliver
Derive $p(x)$ from the geometry (constants BALL_RADIUS, HOLE_RADIUS are above) and
write it down in a markdown cell. It has one free parameter.
Implement it in PyMC and fit it. Report $\sigma$ in degrees.
Overlay its posterior curve on the logistic fit. One parameter versus two - which wins?
Deliver the az.compare table and two sentences: what does it say, and how far do you
trust it here? (Look at the warnings - there are only 19 "observations".)
golf_new: Putts attempted and made by distance (feet), 31 distances, far more putts.
source: Mark Broadie's modern PGA putting data, via Gelman's golf case study.
url: https://raw.githubusercontent.com/stan-dev/example-models/master/knitr/golf/golf_data_new.txt
x
n
y
26
52.36
8708
231
27
57.25
8878
204
28
63.23
5492
103
29
69.18
3087
35
30
75.19
1742
24
Your turn Work this task in the notebook.
#Task 5 · Add distance control (and survive the sampler)
Domain knowledge from a putting coach:
Golfers aim to hit the ball about 1 foot past the hole.
The putt can drop if the ball would have travelled between the hole and 3 feet past it.
The error in how far the ball travels is proportional to the intended distance.
Deliver
Turn that into $p_\text{distance}(x)$ with one new parameter, and combine it with the
angle component (assume independence).
Fit it with a Binomial likelihood. Check the diagnostics carefully. Something will be
wrong - explain why this posterior is hard, in terms of the data.
Fix the model (not the sampler settings!) and refit. Report all parameters and show the
final fit and residuals.
The product team asks: "From what distance is a tour pro a coin flip?"
Deliver the posterior distribution of $x_{50}$, the distance at which $p(x) = 0.5$,
with a point estimate and a 94% interval. Then the follow-up: a coaching intervention
claims to cut distance error $\sigma_d$ by a fifth. How many extra putts per 100 would
that sink from 30 feet?
The final residuals still wiggle systematically between 3 and 12 feet. Propose and test a mechanism.
Refit the final model with the exact Binomial likelihood plus a Beta-Binomial or a
logit-normal random effect per distance instead of the Normal approximation. Do the
conclusions change?
Fit both datasets jointly with shared physics but dataset-specific skill parameters. Did
pros improve between the 1990s and the 2010s?
h.progress()
C01: 0/18 hints used, 6/6 checks passed.
Reference solution
A complete, executed solution with commentary on every task — including the ways the obvious model fails. Try the hint ladder first.