Wednesday, July 04, 2007

Having reached (roughly) the halfway point of the baseball season, with the All-Star Game this coming Tuesday, now seems like a good time to reflect on the home run-hitting performance of the Yankees' Alex Rodriguez this season. As of this writing, A-Rod leads all of Major League Baseball with 28 homers, one ahead of National League leader Prince Fielder and eight ahead of the nearest American League rival, Justin Morneau ( MLB stats page).

It's not merely the number of homers hit by Rodriguez, but also the seemingly clustered nature of his blasts. Thus far this season (and, as I've come to learn, in earlier years), he has seemed to hit home runs in bunches, separated by pronounced cold streaks where he's been unable to "touch 'em all."

In preparing to do this write-up, I did a lot of web-searching on Rodriguez and his home run-hitting prowess. In the process, I found a spectacular visual display of A-Rod's sequences of home-run and non-home-run games, not just for 2007, but for his entire career (done by Ryan Armbrust at a blog called "The Pastime"). One apparent typo is that the year labeled "1995" in the display is really 1996 (compare with Rodriguez's career stats).

With reference to his visual display, Armbrust writes of A-Rod, "He’s been a streaky home run hitter his entire career, as shown by the sparklines below."

However, as social psychologist David Myers notes in his book Intuition: Its Powers and Perils, "Random sequences seldom look random, because they contain more streaks than people expect" (p. 134). Any interested readers of this blog can demonstrate this for themselves by following Myers's example and flipping coins for a while. Every so often, you'll get streaks of several heads or several tails in a row.

A statistical test to determine if A-Rod's sequences of games with and without at least one home run are more bunched into homogeneous segments than would be expected by chance, is thus warranted.

One such approach is the runs test (here, here, and here). Where each trial can have two possible outcomes, such as each baseball game played by Rodriguez either including a homer by him (depicted in red in Armbrust's figures) or not including one (gray in the figures), a run is defined as any streak of consistently the same outcome (all reds in a row, or all grays). We are thus using the term "run" in a particular statistical context and not in regard to how many "runs" a team scores. Also, for present purposes, we are ignoring the distinction between games in which A-Rod has hit 1, 2, or 3 homers -- all are subsumed within the category "1 or more."

If, instead of colors, we use the code number 1 to represent a game with at least one A-Rod homer, and the number 0 to represent a game with no homers by him, we will have various sequences of 1's and 0's.

The key to the runs test is that streakiness is signified by few runs (such as 11110000, which contains two runs), whereas absence of streakiness is signified by many runs (such as 10100101, which contains seven runs).

For any given sequence, we can calculate how many runs would be expected by chance. Then, if the actual number of runs in a sequence turns out to be significantly smaller than expected, we can claim streakiness.

As a simple example, let's say we have a four-trial sequence consisting of two 1's and two 0's, in some order. There are six possible such sequences (those familiar with the n-choose-k principle can think of the problem as 4-choose-2, as we are choosing in which two of the four positions the 1's [or the 0's] would be located).

1100 (2 runs)
1010 (4 runs)
1001 (3 runs)
0011 (2 runs)
0101 (4 runs)
0110 (3 runs)

If we average the number of runs over all six possible sequences, we get 3 as the expected number of runs (18/6).

A simple formula for expected number of runs is 2 X (number of trials with a 1) X (number of trials with a 0), divided by the total number of trials, with 1 added to the previous answer. For the above example, expected runs = (2 X 2 X 2)/4 = 2, plus 1 = 3, matching the above answer. In my table below, I round the expected runs values to the nearest whole number or, if close to ending in .5, to the nearest half-number.

Another resource we can use is an online runs-test calculator, into which we can type in 1's and 0's and, at the click of a mouse, find out if our sequence deviates significantly from expectation (in order for a result to be "statistically significant," by convention we say that there must be a .05 [1-in-20] or smaller probability of the obtained result being due to chance).

Below are the results of my application of Rodriguez's data (from The Pastime, except for a couple of months in 2007, which I gleaned myself) to the runs test. Another point worth noting is that the online runs-test calculator is limited to 80 cases of data. Accordingly, I did hand calculations of A-Rod's actual (observed) and expected runs for both the first 80 games and all games of each season.

With the data from the first 80 games of a given season, I performed a formal runs test only if the actual number of runs was below the expected value (shown in bold), as I wasn't interested in testing if A-Rod was ever less streaky than expected. Then, if it appeared that his actual number of runs for a full season might be substantially lower than the expected value, I also performed a runs test for games 81 and beyond in that season (in cases where he played 161 or 162 games in a season, I used his last 80 games, leaving out the 1 or 2 in the middle of the season). Here are the results...

1996 (shown on The Pastime as 1995)
First 80 games: 35 actual runs, 31 expected runs
Full season (146 games): 57 actual runs, 52 expected runs

First 80 games: 21 actual runs, 21 expected runs
Full season (141 games): 41 actual runs, 39 expected runs

First 80 games: 37 actual runs, 34 expected runs
Full season (161 games): 61 actual runs, 60 expected runs

First 80 games: 39 actual runs, 34 expected runs
Full season (129 games): 57 actual runs, 53 expected runs

First 80 games: 27 actual runs, 30 expected runs (p = .18)
Full season (148 games): 48 actual runs, 56.5 expected runs (for final 68 games, p = .02)

First 80 games: 31 actual runs, 30 expected runs
Full season (162 games): 75 actual runs, 68 expected runs

First 80 games: 29 actual runs, 31 expected runs (p = .27)
Full season (162 games): 65 actual runs, 67 expected runs (difference of 2, though in direction of streakiness, still small)

First 80 games: 32 actual runs, 29 expected runs
Full season (161 games): 62 actual runs, 65 expected runs (reversal of trend from first 80 games is noteworthy; for last 80 games, p = .08)

First 80 games: 32 actual runs, 29 expected runs
Full season (155 games): 55 actual runs, 53 expected runs

First 80 games: 25 actual runs, 25 expected runs
Full season (162 games): 63 actual runs, 64 expected runs (difference of 1, though in direction of streakiness, still small)

First 80 games: 24 actual runs, 28 expected runs (p = .10)
Full season (154 games): 49 actual runs, 50.5 expected runs (difference of 1.5, though in direction of streakiness, still small)

2007 (through 80 games)
First 80 games: 30 actual runs, 35 expected runs (p = .08)

One finding that initially jumps out at me is that A-Rod has been as (or more) likely to exhibit a greater number of homogeneous runs than expected by chance (the opposite of streakiness) in a season, as fewer runs. Overall, I would say there's some very modest evidence of Alex Rodriguez being a streaky home-run hitter, whose dingers tend to come in bunches. But to a large extent, the bunches we see in the visual depictions tend to be the result of randomness.

Once again, I would like to express my appreciation to Ryan Armbrust, whose diagrams of A-Rod's home-run sequences saved me a lot of work!

No comments: