# Interactive visualization of strike-zone expansion

This post takes another look at the model from my last post, ‘A probabilistic model for interpreting strike-zone expansion’. In that post, we restricted focus to pitches thrown around the knees, but as it turns out, we can condition on any location. For that reason, I made this interactive visualization which allows one to condition on any pitch location (within a reasonable resolution) by clicking different cells in the strikezone plots on the left-hand side. By clicking (i.e., conditioning) on different cells, two quantities will dynamically update:

1. The (estimated) odds of a called strike in 2014 compared to 2008 under various scenarios (displayed as text in cells matching the selected location). It’s worth noting that the odds is equal to the (estimated) probability of a called strike in 2014 divided by the (estimated) probability of a called strike in 2008 whereas the color represents 2008 minus 2014.

2. Approximate 95% confidence intervals for the probability of a called strike under various scenarios. These intervals update dynamically on right-hand side of the viz based on the selected location.

By default, the location `px=0; pz=1.7` is selected (which explains why the odds in the static figure of my last post match the odds displayed by default for left handed batters). Instead of providing just the point estimate for the probability of a called strike, the interactive graphic provides a sense of uncertainty in estimates. In fact, if you hover over a particular interval, the lower and upper bounds should appear next to your mouse.

You won’t need to hover to notice that the intervals in a 0-2 count are much wider than those in a 0-0 count (because there is a larger sample size) which means we can be more confident in estimates produced under the latter case. To be precise, we are 95% confident that the first pitch odds are between 2.14 and 2.54, but for an 0-2 count, we are 95% confident the odds are between 1.74 and 10.52. As a result, there is not enough evidence to suggest the odds is significantly different in a 0-0 count versus a 0-2 count. Note that the user can obtain the 95% confidence interval for the odds in any cell by hovering over it (shown below).

Generally speaking, this tool helps reinforce my claim from last time that “called strikes at the knees 2-4 times more likely in 2014”. In fact, that estimate can climb towards 5, but often in more rare situations where we are less confident in the estimate. This tool also suggests that pitches thrown on the outside portion (as well as some on the inside portion) are about half as likely to be called a strike in 2014.

There are clearly many more scenarios we can dissect in more detail using this viz and I hope the reader takes time to play and leave comments with their findings. The viz was created fairly quickly and easily thanks to animint. If you’re curious about the details, feel free to peruse the source code that created it.