Practice · Baseball

Batted balls

Five hundred well-elevated batted balls from a Statcast sample: exit velocity, launch angle and how far the ball went.

The data

One row per batted ball, restricted to launch angles between 20 and 35 degrees, so exit velocity should be the dominant driver of distance. It is the baseline regression in the MCMC session: simple enough to see every part of the sampler's output, real enough that the model is not quite right.

launch_speedexit velocity, mph
launch_angledegrees above horizontal
hit_distancefeet

500 rows. Statcast, via Baseball Savant and pybaseball; a sample from one two-week window of a season, prepared for the MCMC in Practice session. For practice; cite the original source in anything you publish.

Three questions

  1. Warm-up

    Plot distance against exit velocity and fit a straight line by least squares. What does one extra mile per hour buy in feet, and how spread out are the points around the line?

  2. Working

    Fit the same line as a Bayesian regression in PyMC with weakly informative priors. Read everything pm.sample returns: the posterior group, the summary table, R-hat and effective sample size. Report the slope as an interval, not a point.

  3. Hard

    Run a posterior predictive check. Where does the simulated data look unlike the real data, and which of the two extra ingredients, launch angle or a non-constant spread, fixes more of it? Fit both and compare them honestly.

No answers are published here. Work the question, then watch the session and compare your route with the instructor's.

Where the method is taught

MCMC in Practice. Every dataset in the practice library names its session the same way.

Keep up

One email when something new arrives.

First name and email. One message when a session recording, a skill, a cheat sheet or a posting worth your time arrives here, and no other mail. Replies reach a person.