Instructor Guide — Overview

This guide is for anyone teaching from Golf Analytics: a PGA professional running a winter course for members, a sports-analytics instructor who wants a full semester on one sport, or a statistics teacher who wants a data set that students care about and that punishes sloppy thinking. The book is free and open (CC-BY-SA-4.0), and so is everything here. Adapt it, cut it and remix it. Share what you change.

The book makes one promise about numbers, and your course should make the same one: every tour statistic comes from free data the student can download, every amateur or shot-level example comes from a simulator the student can rerun, and every published figure carries its source. Most of the teaching problems in this guide come back to that promise. Students mix up real and simulated numbers, forget which baseline a strokes-gained figure was priced against, or read one round as a verdict. If your students leave able to say "real or simulated, against which baseline, with what uncertainty?" about any golf number, the course has done its job.

Who this guide is for

The book is written for four kinds of reader, and each chapter opens with a routing box for them. The same four tracks organise this guide:

Track Who Parts of the book
⛳ Golfer wants to score lower Parts I–III, light on the maths
📊 Analyst wants the methods everything
🏌️ Coach/Fitter teaches, fits clubs, plans practice Parts I–II, IV and V
🎰 Betting/DFS prices tournaments and lineups Parts I–II, VI and VII

Three teaching settings are covered by the syllabi:

  • Sports-analytics courses (upper-level undergraduate or master's). The 15-week semester syllabus uses all eight parts, with the weight on strokes gained (Part II), professional golf (Part VI) and betting and fantasy (Part VII). Students need some Python.
  • Golf coaches and club fitters (PGA education, fitting academies, club winter programmes). The 10-week coaching syllabus covers Parts I–V and treats the code as something to run and read, not write from scratch.
  • Introductory data science or statistics taught through golf. The 15-week intro syllabus uses Chapter 2, Chapters 10–17, 28 and 31–34 and Appendix E. Golf supplies the motivation; the outcomes are sampling, standard errors, regression to the mean, shrinkage, multiple comparisons, Markov chains, calibration and proper scoring rules.

A fourth syllabus is a 3-day workshop for golfers: no code required of participants, with the instructor running the scripts live.

How this guide is organised

File What it holds
README.md this overview: audience, prerequisites, software, data, lab logistics
syllabus-semester-analytics.md 15-week sports-analytics course, all parts
syllabus-golf-coaching.md 10-week coach/fitter course, Parts I–V
syllabus-intro-data-science.md 15-week intro data science / statistics course built on golf
syllabus-short-workshop.md 3-day workshop for golfers
midterm-exam.md 36 questions on Chapters 1–22, answer key included
final-exam.md 36 questions, cumulative with weight on Chapters 23–40, answer key included
project-rubrics.md rubrics for the yardbook capstone, a case-study report, a tournament-model write-up and a practice plan
common-struggles.md the misconceptions students actually hit, and what to do about each
assessment-bank.md 120 multiple-choice and 40 short-answer questions, three and one per chapter, tagged by track

Per-chapter teaching notes and discussion guides will be added to this folder separately.

Every chapter already contains assessment material you should use before writing your own: exercises.md (Parts A–E plus a mixed Part M, graded ⭐ to ⭐⭐⭐⭐), quiz.md, two case studies, key-takeaways.md and further-reading.md. The syllabi assign from those files by part letter; the exams and the assessment bank are new questions on the same material, so they can be used for grading without students having seen the answers.

Prerequisites

For students on the analyst or intro-data-science track:

  • Python at the level of Appendix A: functions, lists and dictionaries, and enough pandas to filter, group and join a table. Students who have never written Python can do the intro syllabus if you spend the first two weeks on Appendix A.
  • Algebra and a little probability. Means, standard deviations, the normal distribution and conditional probability are used everywhere; Appendix E collects the statistics, and the intro syllabus teaches them as they come up.
  • Calculus is helpful for Part I (the flight equations in Appendix F) but not required. Every derivation is also explained in words.

For coaches, fitters and golfers: no programming. They should be comfortable reading a launch-monitor screen (Appendix H is the glossary) and a table of numbers. The instructor runs the code; participants read the output and the figures.

For you: you will need to run every script you assign at least once on your own machine, before the term, with the data in place. The book's numbers are reproducible, but only if the data snapshot matches (see below).

Software setup

The book was run with Python 3.13; the repository README asks for 3.11 or newer. The packages are listed in requirements.txt at the book root: numpy, pandas, scipy (1.9 or newer, because the DFS lineup optimiser uses scipy.optimize.milp), matplotlib, pyarrow (for the Parquet tables), pytest, and statsmodels (used only by a few Chapter 16 scripts and some data-check scripts).

python -m venv .venv
# Windows: .venv\Scripts\activate      macOS/Linux: source .venv/bin/activate
python -m pip install -r requirements.txt
python -m pytest toolkit/tests -q        # optional: the toolkit's own tests

Two packages ship with the book and need no installation, because every chapter script adds them to the path in its standard header:

  • toolkit/golfkit/ is the shared toolkit: data loaders, strokes gained, the shot simulator (golfkit.shotsim), the ball-flight and impact models, ratings, forecasts and the plotting style. Its reference is Appendix B and toolkit/README.md.
  • project/yardbook/ is the progressive project, the student's personal golf analytics dashboard. Each chapter adds one module; the capstone (Chapter 40) assembles them into a report.

Scripts are written to run from their chapter folder:

cd part-02-strokes-gained/chapter-10-strokes-gained
python code/01_baseline_curves.py          # figures go to images/
python code/project_checkpoint.py          # the chapter's yardbook module, demonstrated

To run whole chapters at once (useful for checking a lab machine): python scripts/run_all_code.py 10 11 --jobs 2. It runs each chapter's scripts in order, with a non-interactive plotting backend, saves fresh output to each chapter's code/_rerun/, and writes a pass/fail and timing table. python scripts/drift_report.py then checks whether the numbers printed in the chapter text still match the code.

Windows and UTF-8

The scripts print degree signs, minus signs and some emoji. On a Windows console using the cp1252 code page, printing them raises UnicodeEncodeError, especially when output is piped. Every chapter script calls sys.stdout.reconfigure(encoding="utf-8") in its header for this reason. Students' own scripts will not, so tell them on day one to either copy the standard header (Chapter 2 shows it) or set Python's UTF-8 mode for the session (set PYTHONUTF8=1 in cmd, $env:PYTHONUTF8 = "1" in PowerShell). A separate, harmless problem: matplotlib's default font has no 🧪 glyph, so putting emoji in figure labels produces a "missing glyph" warning and a box. Keep emoji out of figures. Common struggles has more.

The data: what students must fetch, or what you must provide

The simulator needs no data. Everything real comes from ESPN's open JSON endpoints: hole-by-hole scores for every player in every round of every PGA TOUR event from 2004 to 2026, course par and yardage per hole, and per-player tournament statistics from 2015. The raw and processed data are not in the repository. Either students fetch them, or you fetch once and hand out the processed tables. For any class larger than a handful, do the second.

The sizes (from Appendix C):

Stage Size
Raw JSON: calendars 23 files 0.3 MB; scoreboards 1,050 files 890.2 MB; event documents 1,140 files 158.4 MB; player statistics 597 files 36.6 MB about 1.1 GB
Processed Parquet tables in data/processed/ (events, courses, players, player_events, rounds, holes, player_stats) about 8 MB
Derived caches in data/processed/cache/ and simulated baselines in data/processed/baselines/ on the snapshot used for the book about 9 MB and 0.6 MB

Fetching. From the book root:

python scripts/fetch_espn.py calendar scoreboard events --from 2004 --to 2026
python scripts/fetch_espn.py players --players-from 2015 --workers 4
python scripts/build_espn.py
python scripts/build_player_stats.py

Every phase skips files already on disk, so an interrupted fetch resumes. The fetcher is deliberately slow: it pauses a quarter of a second after every successful request and backs off on failures from 1 to 16 seconds. The players phase is by far the slowest, because it makes one request per player per event (the snapshot's 67,509 statistics rows each cost one request). Do the fetch well before the term, not in a lab session. Ask students who fetch for themselves to use fewer workers and to respect any terms ESPN publishes; Appendix C §C.1 has the courtesy rules and records what was observed about the request header. If the service tells you to stop, stop.

Checking the build. Appendix C gives the test: a rebuild that produces 7,535,490 hole scores and 417,380 complete rounds reproduces this book's snapshot. Run golfkit.data.inventory() and compare. If the counts differ (ESPN adds events every week, and an extended --to changes them), chapter numbers that depend on the data will drift slightly. That is a teaching opportunity, not a disaster, but tell students in advance so they don't think their code is wrong.

Providing the data. Zip data/processed/ (the Parquet tables, plus cache/ and baselines/ if you want fast first runs) and distribute it through your course site. Students unzip it into their copy of the book. Only two scripts need the raw JSON: Chapter 2's 01_raw_json_tour.py and 02_build_rules.py, which explore the raw tree and scan all 1,050 scoreboards. For those, either demonstrate them yourself or hand out a few raw files for the exploration exercise.

What the data cannot do. ESPN has no shot locations, lies, clubs, wind or (in the processed tables) tee times, and no strokes gained by category. LIV, DP World Tour and LPGA hole data are not in the snapshot. Category strokes gained and every amateur's shots in the book are SIMULATED by golfkit.shotsim with fixed seeds. Students must never present a simulated category number as a real tour player's number. Expect to repeat this in every week of Parts II, VI and VII.

Run times

Most chapter scripts finish in 1–20 seconds. On the machine the book was run on, the slow ones were:

Chapter Script Time
8 04_make_curves.py, 05_optimal_pace.py, case_study_01.py about 1.6 min, 2.0 min (3.7 on a busy machine), 2–2.7 min
13 03_hidden_weakness.py about 85–90 s
18 03_flag_vs_centre_tables.py, 04_round_sum.py, 05_simple_rules.py about 60–80 s each
22 01_three_putt_problem.py, 02_fit_lag_putters.py, 04_pace_on_slopes.py about 2–2.5 min each
24 07_did_it_help.py, case_study_02.py about 1.5–1.75 min
35 05_major_gene.py, case_study_02.py 70 s and 100 s
39 06_hazard_design_experiment.py about 75 s

Two cold-start costs matter more than any single script:

  • The strokes-gained table. golfkit.sgtotal.adjusted_sg() builds the field-adjusted SG table on first use (about 6 s) and loads it from cache afterwards (about 0.1 s).
  • The tournament walk-forward. The cached walk-forward predictions that Chapter 34 and later chapters read took 1,021 s to build for the whole window. If you distribute data/processed/cache/ with the tables, students never pay this. If they build from scratch, have them run Chapter 34's first script once, outside class, before the lab.

Caches are keyed to the source files' timestamps, so a rebuilt rounds.parquet invalidates them automatically. Delete the folder to force a rebuild.

Lab logistics

  • One environment for everyone. A shared lab image or a written setup sheet saves the first two weeks. Have students run python scripts/run_all_code.py 2 --jobs 1 as their setup check; it exercises the data loaders, the simulator and the plotting style.
  • Run from the chapter folder. Most "file not found" errors come from running a script from the wrong directory.
  • Headless machines. Set MPLBACKEND=Agg so matplotlib writes figures without opening windows.
  • Seeds are part of the answer. Every simulated number in the book has a seed. When a student's number differs from the text, the first question is "same seed?" and the second is "same data snapshot?".
  • Pair the slow scripts with discussion. Start the two-minute putting scripts at the beginning of a lab and discuss the previous figure while they run.
  • Students' own data. Golfers who track their rounds (Arccos, Shot Scope and similar apps, or a paper scorecard) can import them through yardbook.importers and yardbook.rounds. Treat this as optional and private: never require students to share their rounds, and offer the six cast members' simulated rounds (yardbook.cast) as the default data for every assignment.
  • Gambling content. Chapters 36 and 37 discuss betting and daily fantasy. Teach them as probability and decision-making, never require a student to place a bet, and point to the responsible-gambling resources named in Chapter 36.

The cast and the anchors

Six fictional golfers recur: Rosa Delgado (15.4 handicap), Marcus Bell (7.8), Walt Kowalczyk (18.9), Coach Tasha Nguyen, Dev Raman and Emma Sato (plus-1.2). Their rounds are SIMULATED, and each default sample is a representative 20-round draw. Four anchor examples run through the book and make good exam material because their numbers are fixed: Rosa's practice reallocation (approach is her leak, and a 1.54-stroke improvement is not detectable after 20 rounds), Marcus's water hole (4.13 aiming at the pin against 3.74 at the best aim), Walt's driver (equipment alone recovers about 3 of the available yards; an attack-angle change finds 13.4) and Dev's tournament model (calibrated on 133 held-out real events). Use them; students remember people better than tables.

A note on tone

The book respects the game, and the course should too. Data serve the pure iron and the 40-footer that breaks three ways; they don't replace them. The best sessions end with a concrete action: what to aim at, what to practise, what to change on the launch monitor, and what bet not to make.