Thursday, July 31, 2008

Pudge to the Yankees

Yesterday Ivan Rodriguez was traded from the Tigers to the Yankees. This made sense from one perspective since the Yankees were in desperate need of a catcher and Pudge was available. But this trade raises several questions:

1. Is Pudge really a good hitter?
2. What about his hitting ability at this point (age 36) in his career?

First, Pudge is noted for his high career batting average of .302. But this is a bit misleading, since AVG ignores other ways for a batter to get on base such as a walk. From a OBP perspective, Pudge has a mediocre batting record and also he hasn't displayed much power in recent years. Pudge will be an ok hitter towards the bottom of the Yankees lineup since he is good in hitting singles. But Pudge is a good example of a hitter who looks better than he is based on his batting average.

To understand how Pudge's performance over time, we plotted his batting averages as a function of age. We see that his AVG showed steady improvement in early years, hit a peak in midseason and has displayed a lot of variability (up and down movement) in recent years. How do we make sense of these large changes in AVG in the latter part of Pudge's career? This illustrates the difficulty in learning about a batting ABILITY based on a batter's PERFORMANCE in a single season.

We talked about ways of learning about a player's ability -- that is, his hitting probability -- based on x successes in n at-bats. This discussion showed how little we learn about ability based on a single season. We get a better understanding of a player's ability by looking at his performance over several seasons.

Wednesday, July 30, 2008

The Pre-Game Show

Today we were getting ready for tonight's Mud Hens game. I passed out scoresheets and we talked about how to keep score. I'll be sitting in section 115 with a Phillies cap -- I can help you if you need help scoring particular plays.

In Chapter 7, we are talking about statistical inference. Specifically, how can we learn about a player's ability given his performance.

We did a silly exercise to illustrate the distinction between ability and performance. Suppose the manager Casey has seven types of hitters in his dugout -- a couple of hitters are great in getting on-base and their ability is p=.5; two other players have p=.45; two other players have p=.4, ..., and two crummy players are weak in getting on-base and p=.2. Suppose Casy chooses a player at random and has that player bats 20 times and records X = number of times on base.

We repeat this exercise 10,000 times and we categorize all hitters by their ability (value of p) and their performance (value of X). I passed out the table of counts. Given a particular batting performance, say 8 out of 20 on-base, I showed how you can compute the probabilities of the player having different batting abilities.

Tonight we'll keep score, compute a couple of OBPs and SLGs and be on the lookout for lucky plays.

Tuesday, July 29, 2008

The M&M Boys

Today we saluted the M&M boys, Mickey Mantle and Roger Maris, who were featured in the movie 61*. Yankee Stadium was the "house that Ruth built" and Mantle and Maris challenged Ruth's single season home run record of 60 during the 1961 season. Mantle and Maris had different personalities. Mantle was the leader of the 1961 team and enjoyed life, especially late in the evening. In contrast, Maris was shy and did not like all of the media pressure during the chase to break Ruth's record.

In class, we compared batting statistics for the two players. From a career perspective, Mantle was clearly the better offensive player -- his average OPS value was significantly higher than Maris' average OPS. Also, Maris' home run total of 61 in 1961 was unusual relative to his home run totals in his other years. Many people thought that Maris was not deserving of breaking Ruth's record, but this assessment is a bit unfair. Maris had a few great seasons, winning the MVP (most valuable player) title two consecutive seasons.

We concluded with a rolling dice activity. We considered two hypothetical players, Jeff and Bobby, who we know have mediocre and good probabilities of getting on-base. By rolling 10-sided dice, we looked at the performances of these two players in 10 plate appearances. By writing down the results of the rolls in a table, we can look at the relationship between a player's ability (value of p) with his performance (number of times on-base).

Monday, July 28, 2008

The Spinner Game

Today we played our spinner game -- quite a high-scoring affair -- the American League all-stars won over the National League all-stars 25-18.

Why did the AL team win? There are several explanations:

1. The AL was the better team with the better ballplayers.

2. There was no pitching. (Actually in this game, the pitcher isn't a part of the game, so the game has literally no pitching.)

3. The AL had more luck -- their spinners went the right way.

4. The people controlling the AL spinners were cheating. (Although some of your spinners didn't work that well, I don't believe you were cheating.)

This relates to the main subject of the next chapter. In statistics, we see a lot of variation in data and we have to figure out how much of the variation is due to skill and how much is attributable to luck or chance variation.

We distinguished between a player's ABILITY and his PERFORMANCE. We observe how players perform in games, and from the performance data, we want to learn about players' abilities.

Luck is a dirty word in baseball -- no player wants to say that he did well or that the team did well due to some lucky breaks. But luck or chance variation plays a big role in the variability of player and team performances. Statisticians want to understand this variability, so we can draw conclusions about ability.

Thursday, July 24, 2008

Binomial experiments

Today we talked about binomial experiments and the associated probabilities. Suppose we have a experiment where (1) you have a sequence of n trials, (2) on each trial, there are two outcomes, Success or Failure, (3) the chance of a Success (p) is the same from trial to trial and (4) the results of different trials are independent. Then the number of successes X has a binomial distribution.

Once you identify a binomial experiment, you have to figure out n, the number of trials, and p, the chance of a success. Then you can find probabilities of different outcomes by a table of binomial probabilities.

This can be applied to chance outcomes in baseball. In our Fathom lab, we suppose that Susuki has five plate appearances and we're interested in the number of times he gets on base. His OBP percentage is approximately 40%. This is (approximately) a binomial experiment with n = 5 and p = .5 where we define a success as getting on base. On Fathom, we can display the binomial probabilities -- we can find the chances that Susuki gets on base 0, 1, 2, 3, 4, or 5 times.

What is interesting is that actual baseball data (that is, the number of times Susuki gets on base different numbers of times) matches up well with the binomial distribution. The underlying assumptions aren't quite true. For example, the chance that Susuki gets on base likely changes depending on the pitcher and team that he faces. But this model gives reasonable answers and helps us understand the variation in the hitting data.

Wednesday, July 23, 2008

Matching birthdays

Today we illustrated a famous problem in probability called the birthday problem. Suppose you look at the active roster of a Major League team -- what's the chance that at least two people will have matching birthdays (month and day)? The answer is surprisingly high -- over 50%. Since I wasn't sure if you believed this, I had each of you find the active roster for one MLB team. Thirteen of us found rosters, and in 9 of these rosters, we found a matching birthday. So

Prob(match) is approximately 9/13.

We also talked about several more sophisticated baseball simulation games. You will be making spinners for the All-Star Baseball game. Here each batter is assumed to have a different ability and the chances that he will get a walk, out, single, etc are represented by slices of the spinner. A more sophisticated game Strat-O-Matic is based on the use of player cards (both batters and pitchers) and three dice. Strat-O-Matic actually is a very realistic game in that the games resemble actual baseball games.

We'll be covering Chapter 5, Probability distributions, tomorrow.

The Phillies had a great victory over the Mets last night -- hopefully Bret Myers will come through for the Phils tonight.

Tuesday, July 22, 2008

Determining probabilities

Today I gave you a little practice in specifying probabilities. What did we learn?

1. If the Mudhens played the Tigers, there are two possible outcomes (Mudhens win, Tiger wins), but they wouldn't be equally likely. I think the Tigers are the stronger team, so the probability that the Tigers win would be larger than 0.5.

2. Surprisingly, the chance that there are two matching birthdays on a baseball roster is over 50% -- we'll check this out soon.

3. Coins have no memory. So if you flip five consecutive heads, the chance that the next flip is heads is still 0.5.

The rest of the class was devoted to the Big League Baseball dice game. In the Fathom lab, we played both parts of the game many times. We were able to compute the probability that the red die will result in a strikeout, and compute the probability that a "in-play event" is a home run. Tomorrow, we'll see how these game probabilities match up with the probabilities of these events in real baseball.

Monday, July 21, 2008

Introduction to Chance

Today we started the second half of the course that will deal with probability and statistical inference (the process of learning from data).

What did we learn?

1. Life is uncertain.
2. We use probability to quantify the uncertainty we see.
3. We got a little practice assigning probabilities.

We'll learn about probability through playing and analyzing simulation games. We introduced our first game Big League Baseball based on rolls of three dice. A red die represents the pitch and two dice determine the "in-play" outcome.

Tomorrow, we'll simulate Big League Baseball in the lab and we'll introduce the second game All-Star Baseball based on spinners.

Wednesday, July 16, 2008

Shoeless Joe

Today's class was dedicated to Shoeless Joe Jackson. Jackson was a great player whose career was abruptly ended by his implication in the Black Sox Scandal. He was removed from major league baseball by the commissioner due to his possible involvement in the the 1919 World Series? We really don't know what happened. But his life has inspired books and movies such as Field of Dreams.

Since Joe Jackson played at the same time as the great Ty Cobb, a natural question to ask was: Who was the better player. Since getting on base is a desirable goal of a hitter, we compared the season OBP's of Jackson and the OBP's of Cobb. We constructed back-to-back stemplots and five-number summaries. We learned that Cobb was better in getting on-base than Jackson -- on average, Cobb was about 20 points better.

We concluded by watching a portion of Field of Dreams. One of the best parts of the film is watching the ghost players of the past play a game. James Earl Jones gave one of the great speeches about baseball:

"Ray, people will come Ray. They'll come to Iowa for reasons they can't even fathom. They'll turn up your driveway not knowing for sure why they're doing it. They'll arrive at your door as innocent as children, longing for the past. ... And they'll watch the game and it'll be as if they dipped themselves in magic waters. The memories will be so thick they'll have to brush them away from their faces. People will come Ray. The one constant through all the years, Ray, has been baseball. America has rolled by like an army of steamrollers. It has been erased like a blackboard, rebuilt and erased again. But baseball has marked the time. This field, this game: it's a part of our past, Ray. It reminds of us of all that once was good and it could be again. Oh... people will come Ray. People will most definitely come."

Tuesday, July 15, 2008

Team Wins & the Best Batting Measure

Today we looked at the number of wins of a team for the 2006 and 2007 seasons. Our interest was to predict the number of 2007 wins given the number of 2006 wins. I gave you a simple prediction formula. We talked about predicted values and residuals. A good line is where the squares (the sum of squared residuals) is small. The least-squares line makes the sum of squared residuals as small as possible.

We also illustrated regression to the mean. We plotted a team's improvement (2007 wins - 2006 wins) against the 2006 wins. We saw that crummy teams in 2006 tend to show positive improvement, and good 2006 teams tend to show negative improvement. This is good news for Indians fans. They are currently having a poor season, but because of the regression effect, they likely will improve next season.

In the computer lab, we searched for the best batting measure. We looked at team data and looked at the relationship between runs scored per game and the batting measures AVG, OBP, SLG, and OPS. The best batting measure is where the squares (sum of squared residuals) is smallest -- using this criterion, the OPS measure is best.

Monday, July 14, 2008

How long is a baseball game?

Today we looked at the lengths of baseball games. Most games like football, basketball and soccer have periods or quarters of a set length. Baseball is different -- it ends after 9 innings (or 8 1/2 innings if the home team is leading in the ninth).

What did we learn?

1. Baseball games in 2007 averaged 175.5 minutes -- almost three hours. In contrast, the median length of baseball games in 1967 (40 years ago) was 150 minutes -- about 25 minutes shorter than 2007 games. I'm not sure why this is true. Is it due to the greater number of pitchers? Or perhaps due to the TV commercials?

2. To understand the reasoning for the variation in the lengths of baseball games, we looked at the relationship between TIME.OF.GAME and several predictors including number of AB, number of Hits, number of SO, and BFP (batters faced pitcher). The strongest association was between BFP and TIME.OF.GAME. In contrast, there was little association between SO and TIME.OF.GAME.

3. We can measure both the direction and strength of association with a correlation r. I described several properties of r and we got some practice matching up values of r and the corresponding scatterplots.

4. I concluded with some fundamental ideas from sabermetrics (the scientific study of baseball data). What is the best batting measure among AVG, OBP, SLG? Can we find the batting measure that is better than AVG, OBP, SLG? We'll address these questions next class.

Thursday, July 10, 2008

Mickey Mantle and Ticket Prices

Today, we started with some Mickey Mantle data. We collected the number of home runs (HR) and runs-batted-in (RBI) for all 18 seasons and constructed a scatterplot of HR and RBI. We were interested in predicting Mantle's RBI total given a number of HR. We fit a line by eye and found the equation for the line. My line was

RBI = 2 HR + 20

If Mantle gets 50 home runs one season, I would predict his runs-batted-in to be

RBI = 2(50) + 20 = 120

Then we moved over to the lab and look at the costs for attending a baseball game. What did we learn?

1. There is a lot of variation in team payrolls -- one team's payroll is about 10 times another team's payroll.

2. We (the fans) are paying for these rich teams through high ticket prices, high beer prices, high hot dog prices, etc. By comparing the ticket prices of the rich and poor teams, we found how much more it costs to attend a game of a rich team.

3. Orel Hersheiser and I have several things in common. We both grew up in the Philadelphia area and both us rooted for the Phils when we were young. (I'm still a Phillies fan, but I'm not sure about Hercheiser.) And of course, we're both connected with BGSU.

Have a good weekend.

Baseball movies

What are two of your favorite baseball movies? If there are several ones that seem popular, I'll show some excerpts from these movies during class.

Wednesday, July 9, 2008

Baseball attendance

Today we started talking about the economics of baseball. Teams make money by selling tickets, concessions, and advertising. Teams want to have fans attend games. But we saw that there is a lot of variation in the average attendance among teams. Particular teams such as the Yankees, Mets, and Red Sox get large attendances, while other teams such as the Marlins the Royals have small attendances.

Why do the average attendances between teams vary so much? I suggested a couple of possible reasons.

1. Market size. The market refers to the population of people who potentially can attend a game. The market size varies greatly among teams. Big cities such as New York, Los Angeles, and Chicago have large markets, while small cities such as Kansas City and Pittsburgh have small markets.

2. Team success. It would seem that winning teams (either in the present or in the past) would be a factor -- one would think that winning teams would draw more fans.

Today we looked at the relationship between average attendance and variables such as market size and team success. What did we learn?

1. There is a clear positive relationship between market size and average attendance. Simply, larger markets tend to draw more fans. There are some exceptions to this pattern. For example, St. Louis tends to draw many fans despite a small market. The Indians did well in drawing fans in the first years of a new ballpark.

2. There doesn't appear to be a relationship between the current winning percentage of a team and its average attendance. Maybe many of the tickets are purchased at the beginning of the season.

Next class, we'll focus on the different costs of attending a baseball game and see if these costs are related to the teams' payroll.

Tuesday, July 8, 2008


Today we talked about one big idea and then had our 2nd Fathom lab.

When you hear that some historical player had a .372 batting average, you should ask ...
1. When season did the player get this batting average?
2. Where did the player play ? (The ballpark could have influenced his batting average.)
3. How many at-bats? (We'll see that it is easier to get a high batting average with a small number of at-bats.)

To really understand the greatness of a historical batting average, we look at the player's average in the context of all batting averages of regular players that season. If we compute the mean and the standard deviation of the batting averages, then we compute the z score

z = (AVG - mean)/s

This tells you how many standard deviations the guy's AVG is above or below the mean. If z = 4, that is a wow -- his batting average is four standard deviations above the mean.

In the Fathom lab, we compared the offensive stats of the American League teams and the National League teams this season. We learned that the AL teams tend to score more runs per game. The slugging percentages of the AL teams are pretty similar to the slugging pcts of the NL teams, but the AL teams seem to be better in getting on base. Since the AL teams tend to be better on OBP, they tend to score more runs.

Why is the AL better? There are likely several explanations, but the fact that the AL has the DH probably helps them score more runs.

Monday, July 7, 2008

Maddux and Clemens

What did we learn today?

1. It is tough to show a youtube streaming video when the wireless connection is slow. We watched part of a Ken Burns documentary segment about the 1927 Yankees. This team featured two of the greatest sluggers in history, Babe Ruth and Lou Gehrig.

2. We talked about the important hitting statistics that you should know how to compute from the basic counting stats (H, 2B, 3B, HR, AB, BB): AVG (batting average), OBP (on-base percentage, and SLG (slugging percentage).

3. We compared two great modern pitchers Greg Maddux and Roger Clemens. We focused on the season WHIP values for the two pitchers. (WHIP is the average number of hits and walks allowed per inning.)

Here is our method:

-- we constructed back-to-back stemplots of the WHIP values for the two pitchers
-- we summarized each collection of WHIPS by a five-number summary. This summary gives us a measure of average (the median) and a measure of spread (the IQR)
-- we compared the spreads of the two batches -- the spread of Maddux's WHIPs is about the same as the spreads of Clemens' WHIPs
-- IF the spreads of the two batches are roughly equal (as they are here), we can compare batches by comparing the medians.

What did we learn in this comparison?

-- Maddux, on average, had a slightly smaller WHIP than Clemens.
-- If we look more closely, I think we would see that Maddux was a better pitcher than Clemens.
at his peak -- Maddux had several outstanding pitching seasons when he was 28 or 29.
-- But overall both pitchers were strong over long periods of time.

Wednesday, July 2, 2008

Pete Rose and the Big Red Machine

In today's class, we honored Pete Rose and one of the great Reds teams of the past. Here's what we did:

1. As a warmup, we looked at histograms of the OBP's and walk numbers for the 2007 regular baseball hitters. We saw that OBP's are symmetric-shaped, while walk counts are right-skewed. (This is a general result: counts of things like walks, strikeouts, home runs, and so on tend to be right-skewed, and derived stats (like AVG, OBP, OPS) tend to be symmetric.)

2. Pete Rose was quite a player. He played for 24 seasons and collected a ton of hits, although most of them were singles. Your prof has a soft spot for Rose since he was a member of the 1980 Phillies, but he did gamble on baseball which has kept him out of baseball's Hall of Fame.

3. We computed five number summaries for Rose's season hit counts and his RBI counts. Rose's median season hit was remarkably high -- many other players would be happy to have a single season with Rose's median number of hits. In contrast, Rose was not a high RBI man, but that may be due to the fact that he batted first or second in the batting order.

4. We looked at the ages of the 1975 Reds, one of the greatest teams of history. Rose was an old guy (34) on this team, but he still would play 12 more seasons of baseball. The mean age of the 1975 Red hitters was 27.5, pretty young. We used this example to illustrate the idea of a deviation and a typical (or standard) deviation.

5. When data is bell-shaped (like OBPs or AVGs), then we can use the mean and standard deviation to construct an interval that contains 68% or 95% of the data.

Have a great 4th of July weekend. Next week we'll start looking a comparisons between datasets. Is Bonds better than Ruth? Is the AL better than the NL?

Tuesday, July 1, 2008

Baseball Shapes

Today in our first Fathom lab, we explored statistics for all "regular" batters in the Major Leagues last year (2007). We saw ...

1. A collection of batting averages tends to be symmetric shaped with an average of about .280. The lowest batting average last year belonged to David Ross of the Reds. Ross is a catcher, one of the more important defensive positions, so a low batting average is ok if he is a good catcher.

2. In contrast, a collection of home run counts tends to be right-skewed. A lot of player have low or moderate home run counts and the big home run hitters stand out.

3. We looked at the collection of on-base percentages (OBP) for a single player. Generally if you plot a player's OBP's against year, you'll see an interesting shape that looks something like this.

Players generally peak around the ages of 28-30.

4. We briefly looked at a piece of exciting new PITCHf/x data. Specifically, we looked at the distribution of the pitch speeds of Cole Hamels' pitches for the first game he pitched for the 2008 season. Here's a dotplot of the pitch speeds:

To help understand the bimodal distribution, we plot the pitch speed against the pitch type (FAstball, CUrveball, or CHange).

We see that fastballs for Cole are in the mid 80's, his changeups are in the mid 70's, and curveballs somewhat slower.

In our class time, we talked about the progression of the season home run record from Ruth (1927) to Maris (1961) to McGwire (1998) to Bonds (2001).

Tomorrow, we'll talk about summaries for a single batch of data.

Monday, June 30, 2008

The First Day

Today was our first day of class.

I asked you to tell me your favorite teams and players. Your responses were for teams, Cubs (1), Tigers (3), Red Sox (1), Indians (4), Reds (7), Nats (1), and for current players, Granderson (2), Inge, Wakefield, Verlander, Guillen, M. Ramirez, J. Hamilton, Griffey Jr (3), Arroyo, Dunn, Thome, Ordonez, Garko, and Sizemore.

Did you know what a batting average was? Generally, no -- only 6 out of 17 gave a correct definition of AVG.

What did we learn today? Here are some highlights.

1. We distinguished "small s" statistics from "big s" Statistics -- we are primarily interested in the science of learning from data.

2. We illustrated a statistical investigation starting with the question "Is Tim Wakefield a good pitcher?" We start with a question, collect relevant data, organize, graph, and summarize the data, and draw conclusions that will answer the question of interest.

3. I briefly described the game of baseball -- for extra reading, look at Appendix A of the book.

4. By looking at Lance Berkman's season batting averages, I illustrated using a dotplot and a stemplot to graph data and show the distribution.

5. What do we look for when we graph data? A description of its SHAPE, some statement about AVERAGE value, some statement about SPREAD (give an interval that contains half of the data), and comment on UNUSUAL values or features of the data.

6. By exploring stats on the back of baseball cards, we got some experience in graphing and talking about data distributions.

Wednesday, June 25, 2008

Welcome to MATH 115 Introduction to Statistics

Welcome to Introduction to Statistics, baseball style.  The goal of this class is "statistical literacy".  That is, we want to you make you better equipped to read and understand statistical thinking as reported in the media.  We'll use baseball as our way of learning about statistics.  Baseball is the most statistical of all sports.  We'll learn a lot about baseball and the statistical thinking about the game.