Saturday, June 23, 2012

Baseball Contract Analysis

We've been going through contract and salary data, in order to improve the artificial intelligence in Baseball Mogul 2013 and future versions.

Contract Lengths for Major League Baseball Players (n = 516)
We examined the 516 players on Major League 40-Man Rosters (as of opening day) that had reached either arbitration or free agency. The first fact worth noting is that the vast majority (84%) of all player contracts are between 1 and 3 years. The longer deals get all the headlines, but the shorter deals dominate team rosters.

In fact, more than half of the contracts (almost 53%) were for just one year. As might be expected, these one-year contracts were at the lowest salary levels. They were also awarded to older players (age 31.2) showing that one-year contracts are used primarily to sign journeymen that fill out the roster and provide depth in case of injury.

Contract Length Players Share Average Salary Average Age
1 Year 272 52.7% $3.51 Million 31.2
2 Years 126 24.4% $4.86 Million 31.4
3 Years 34 6.6% $7.80 Million 29.7
4 Years 22 4.3% $9.45 Million 28.9
5 Years 203.9% $10.16 Million 28.5
6 Years 26 5.0% $13.01 Million 28.7
7+ Years 16 3.2% $19.18 Million 30.1

Of the 272 players with 1-year contracts, almost half (42%) had been awarded those contracts during arbitration. The average age of players with contracts awarded in arbitration was 28.6. If we remove those contracts from the pool of 1-year contracts, the average age rises above 33.

1-Year Contracts Players Share Average Salary Average Age
Arbitration 113 21.9% $4.41 Million 28.6
Non-Arbitration 159 30.8% $2.24 Million 33.1

Finally, if we look at the "Overall" rating assigned by Baseball Mogul, we see that the longer contracts at higher salary levels are awarded to the more talented players.

(Here is the data with the arbitration contracts split out from the pool of 1-year players)

Contract Length Players Overall Rating Average Age Average Age
at Signing
(Arbitration) 113 78.9 28.6 28.6
1 Year 159 79.9 33.1 33.1
2 Years 126 81.4 31.4 30.8
3 Years 34 84.7 29.7 28.6
4 Years 22 85.6 28.9 27.4
5 Years 2085.0 28.5 26.5
6 Years 26 88.2 28.7 26.1
7+ Years 16 90.7 30.1 26.6

It seems that the youngest group of players are those with 5-year contracts, with the average age rising again for 6-year and 7-year contracts. However, if we instead calculate the average age at which the contract was signed, we see a steady downward trend towards signing younger players to longer deals. This would seem to go against the conventional wisdom which holds that players don't sign deals of this magnitude (7+ years) until their late 20s (or early 30s), when they have had enough time to prove their worth on the free agent market.

Wednesday, June 20, 2012

Windows Screen Resolutions (and Operating Systems)

Baseball Mogul 2013 in a 640x480 window
Just an update for game designers and web designers, since it can be hard to find all of this information in one place. The following is a list of the most popular screen resolutions for Windows machines:

Resolution Share Width Height Ratio Type
1366x768 20.8% 1366 768 1.78 Widescreen (16:9)
1024x768 17.5% 1024 768 1.33 Video (4:3)
1280x800 12.1% 1280 800 1.60 Widescreen (8:5)
1280x1024 7.0% 1280 1024 1.25 Video (5:4)
1440x900 6.4% 1440 900 1.60 Widescreen (8:5)
1920x1080 5.6% 1920 1080 1.78 Widescreen (16:9)
1600x900 4.1% 1600 900 1.78 Widescreen (16:9)
1680x1050 3.6% 1680 1050 1.60 Widescreen (8:5)
768x1024 2.4% 768 1024 0.75 Vertical (3:4)
1360x768 2.4% 1360 768 1.77 Widescreen (16:9)
1024x600 2.2% 1024 600 1.71 Widescreen (5:3)
1280x720 1.6% 1280 720 1.78 Widescreen (16:9)
1280x768 1.5% 1280 768 1.67 Widescreen (5:3)
1152x864 1.4% 1152 864 1.33 Video (4:3)
1920x1200 1.1% 1920 1200 1.60 Widescreen (8:5)
800x600 0.9% 800 600 1.33 Video (4:3)
1280x960 0.7% 1280 960 1.33 Video (4:3)
1093x614 0.6% 1093 614 1.78 Widescreen (16:9)
2560x1440 0.4% 2560 1440 1.78 Widescreen (16:9)
1311x737 0.4% 1311 737 1.78 Widescreen (16:9)
Other 7.5%

Some facts to take away:
  • "1024 x 768" is no longer the most common screen resolution.
  • About 96% of Windows machines have a width of 1024 pixels or more.
  • About 75% of Windows machines have a width of 1200 pixels or more.
  • About 65% of screens are now "widescreen". That is, they have an aspect ratio closer to the new High Definition format (16:9) than the old Low Definition format (4:3). 
  • A significant share of monitors (probably 3-5%) are being used vertically.
And here's the operating system breakdown (among Windows machines):


Windows 7 Windows Vista Windows XP
Game Players 69.6% 12.6% 17.8%
Classrooms 62.8% 4.9% 32.3%
Installed Base 50.6%11.3% 38.1%
Average 61.0% 9.6% 29.4%

Tuesday, May 29, 2012

Pythagoras Explained


Pythagoras of Samos, mathematician and philosopher, died about 2500 years ago. Nevertheless, his name is familiar to baseball fans. The "Pythagorean Expectation", invented by Bill James in the 1980s, predicts a team's winning percentage from runs scored and runs allowed. Despite the intimidating name, Pythagorean win expectations can now be found on mainstream sites like ESPN and MLB.com.


The Pythagorean Theorem

The original Pythagorean Theorem states the following for right triangles (triangles with a 90-degree angle):

The square of the longest side equals the sum of the squares of the two shorter sides.

To put it visually, the area of square 'c' always equals the combined areas of squares 'a' and 'b':


Pythagorean Expectations

James' Pythagorean Expectation uses a similar formula to express the fact that a team's winning percentage can be predicted by comparing the square of the team's runs scored to the square of the team's runs allowed.

Specifically, the ratio of wins to losses correlates with the ratio of those two squares:

Wins : Losses   =   Runs Scored 2 : Runs Allowed 2

The reason this formula evokes Pythagoras' name can be seen in this diagram. If the lengths of each side are represented by a team's runs scored and allowed, their balance of wins to losses is shown by the area of the squares.


Take the 2004 Red Sox as an example. They scored 949 runs while only allowing 768.
  • 949 = 900601
  • 768 = 589824
  • Projected Winning Percentage = Projected Wins / (Projected Wins + Projected Losses)
  • Projected Winning Percentage = 900601 / (900601 +  589824)
  • Projected Winning Percentage = .604 (98 - 64)
A .604 winning percentage in a 162-game season equals a record of 98-64. In real life, the 2004 Red Sox were 98-64. So, as some stat nerds might say, "Pythagoras was right".

Player Value

Predicting team winning percentage is useful, but the Holy Grail for general managers is a formula that determines player value. So, we use the Pythagorean formula to determine how many runs a player needs to create (or prevent) for that team to win one more game than it would otherwise.

If a team scores 810 runs and allows 810 runs, we can predict a winning percentage of .500. That is, the team should go 81-81 over a 162-game season.

For a team that scores 820 runs but still allows 810, the Pythagorean formula predicts a winning percentage of .506. This corresponds to a record of 82-80. In other words, 10 additional runs are needed to turn one loss into a win.

This is the math that underpins modern player valuation techniques such as Wins Above Replacement (WAR). By analyzing thousands of games over the last 50+ years, we calculate how many runs each play creates. For example, a double creates about 0.85 runs. A home run creates about 1.40 runs.

Then, if the above team adds a player in the off-season who contributes 21 more doubles and 30 more home runs than the player he replaces, that will create an additional 59.85 runs (21 * 0.85 + 30 * 1.40). Since every 10 runs creates an additional win, this player will add about 6 wins to the team's projected won-loss record.

The same math is used for pitching and defense. If a center fielder with great range converts 20 doubles into outs over the course of a season, he has prevented the opposition from scoring about 17 runs -- the equivalent of 1.7 wins.

Saturday, March 31, 2012

Kickstarter Project





Just a quick plug for a very cool project I'm working on with some friends (for October, when the weather is great and my brain isn't knee-deep in baseball code).

Live-action gaming is one of the world's most maligned hobbies. But my experience is that getting out into the woods with other people and killing zombies in the middle of the night is a lot less dorky than sitting at home alone playing World of Warcraft.

Please pass this link along to anyone who might be interested (in New England, or willing to drive).

Role Models (a very funny movie)

Monday, February 27, 2012

The Day I Tried To Hide My Giant Black Penis

My wife and daughter went out yesterday afternoon, leaving me at home on a Sunday for the first time in a while. The perfect time to do something incredibly important that I couldn't do with other people around:

Hide My Giant Black Penis

Oops. I think I need to go back about a year. My father is a Selectman for a small New England town. Every year they have a "winter festival". Normal Americans go inside each winter and wait until barbecue season comes around again. But in rural New England, sub-zero temperatures are a great excuse for an outdoor "festival". Every interest group in town contributes some sort of sculpture. The local high school builds a unicorn. The Rotary Club builds a fire truck. The Lions build ... (wait for it) ... a lion.

The next morning, before sunrise, my Dad gets a call that they need "help" with the cleanup. He shows up to find that right next to the unicorn and fire truck, someone has a deposited a giant black penis. Or, at least, a reasonable facsimile thereof. Solid rubber. About two feet tall. Mostly erect (but not entirely). With one giant round testicle to either side. Jiggling a bit despite the hard frost on the ground. It probably weighs thirty pounds. When I say "black", I mean black. It's not Obama black, or even Wesley Snipes black. It's Darth Vader black.

Apparently it's the job of the town's 2nd Selectman to clear the Town Green of any and all giant penises, before the town's residents see it on their way to church. As he picks up the penis, one of the testicles falls off. I guess that's why the pranksters were willing to part with this giant black dildo. Once it breaks, you can't use it anymore. You have to go buy a new one.

My father didn't know what to do with the penis. So I called dibs. You never know when you'll need a giant black penis.

I brought it home and hid it in our abandoned chicken coop. I wanted to put it somewhere that my 11-year-old daughter (and her friends) wouldn't accidentally find it. But by the time Autumn rolled around, they were playing hide-and-seek in the yard. A lot. And the chicken coop was the perfect hiding place. Thankfully, no one found it. When you hide, you look *out* to see if anyone's going to find you. So you don't notice it when you are squatting down on an absurdly over-sized rubber dildo.

Nevertheless, the penis needed a better hiding place. I should have moved it when the power went out for nine days and I was bored. But I didn't think of it. So now it's February and I have some privacy. Time to hide the penis.

Because I can't really think of a better hiding place, I figure that I will just conceal it. I grab a large cardboard box from the garage and head out to the coop. The penis won't fit in the box. I head back in to get a tape measure so I can measure the penis.

Now here's the problem. I have ADD. And it's been really bad recently. I lost my ADD prescription so I've run out of ADD meds. Last week I started siphoning kerosene into my kerosene heater and wandered away. I didn't realize this until I heard the kerosene overflowing and splashing onto my driveway. Then I proceeded to leave an open container of kerosene in the back of my pickup truck. When my wife went to get the truck inspected, she was driving a 50-mile-an-hour Molotov cocktail.

So now I have a thirty-pound black dildo, standing upright in my side yard. Visible from my driveway. And I've gone into the house to get a tape measure. I find a tape measure, but it isn't the *good* tape measure. And I like my good tape measure, so I keep looking. Then I realize I have to send an important email to Korea before they get to work on Monday and since they are 13 hours ahead, I have to get it written and sent right now. And I have to bug my co-worker about checking in some computer code. And then I see that my friend Matt has played "ZITHER" in "Words With Friends". Now it's my turn.

Thankfully, I have some ADD coping skills. One is to set the oven timer to 5 minutes when I'm starting a task, to remind me to get back on task. The oven beeps three times and I realize there's still a big black dong in my yard.

I decide the wise thing to do is to just go measure it with the crappy tape measure. Back out into the cold. The penis is twenty-three and a half inches. And about a foot wide (if you include both the attached and unattached testicles).

Back into the house for a bigger box. And then the basement. And then the garage. I come to the stark realization that I don't have a box big enough to hold the penis. And I've started to re-organize the shelves in my basement. Oh, shit!!! What was I just doing?!?

So I just grab a big black plastic garbage bag and go back outside. I wrap up the dildo and tuck it in the darkest corner of the chicken coop. It turns out that wrapping black plastic around a giant black penis doesn't help much. It just adds wrinkles. Before, it looked like a giant black penis. Now it looks like a giant black uncircumsized penis.

There's only one place left for the penis. The people who built my house didn't finish building it before they sold it to us. There is an unfinished room above the garage. The only way into this space is through an exterior door. The door is 13 feet off the ground. There are no stairs. It's the one place my daughter and her friends would never hide.

Into the garage to get the 20-foot folding aluminum ladder. Back to the chicken coop to get the 23-inch penis. Back to the house. Lean the ladder up against the house. Prop up one side with a loose rock to try to make it level. Tuck the penis under one arm. It's heavy and awkward, but I've been working out.

Halfway up the ladder, I hear some beeping noises. When I went outside, I took my phone with me. I wanted to be sure that my wife or daughter could reach me if they needed to. The phone is in the front pocket of my leather jacket. Right next to the penis. It seems that the penis has just "butt-dialed" someone. From my pocket, a woman's voice says "hello?".

But I don't have time for small talk. I'm halfway up a ladder, in February, with a thirty pound penis. I must soldier on.

As I get to the top, my left hand (the one without the penis) has trouble grabbing the ladder. It's below freezing and very windy. The sun is setting and I just spent the last ten minutes unfolding my rusty aluminum ladder. Aluminum isn't supposed to rust. But this ladder doesn't know that. The ladder has three joints that each lock at a variety of angles. By the time I have the ladder unfolded, my fingers are numb from the cold. On my right hand, my fingers aren't as cold. They have been protected by the black plastic bag that holds the penis. I have to switch the penis to my other hand. I have to roll the giant balls across my body so that that head of the penis is facing my house, and then grab it under my left arm, all without letting go of the ladder. And I have to do it quickly. Before my daughter, and her friend, and her friend's parents, pull into the driveway.

It's difficult. I almost drop the penis. But I don't drop it. I don't want to break it. The head of the penis, about the size of a cantaloupe, is now resting peacefully against the sill of the doorway.

Just then, something shoots out of the penis. It hit me in the face and then darts away. A bird! There is a bird's nest in the corner of the doorway. I had assumed it was empty. I was wrong. It seems that a giant penis blocking out the sun is enough to scare a small bird into abandoning it's nest.

"Startled" is an understatement. After I watch the bird fly off into the trees behind me, I realize that the top of my ladder is no longer touching my house. Everything moves in slow motion as the ladder tips farther backwards. I look down at the jagged boulder I'm about to fall on. When I die, my obituary will say "Died Holding A Thirty-Pound Penis". Or "Killed By A Giant Black Schlong".

But the ladder stops moving. The penis saved me!!! Without thinking, I have straightened my left arm. I am holding thirty pounds of simulated penis meat at full extension. Our center of gravity is now on the other side of the ladder, and the ladder inches back towards my house. As the ladder clatters into the vinyl siding, I thank God for my giant black penis.

I can still feel my heart pounding in my chest. But the doorknob is within reach. I open it with my right hand, slide the penis in, and slam the door shut.

By the time my family comes home, the penis is shrouded in total darkness and the ladder is folded up and put away.

Yay!

-- President, Sports Mogul Inc.
cjd@sportsmogul.com
http://www.sportsmogul.com 

Sunday, February 26, 2012

When Zombies Attack ... Morons


The Walking Dead is dumb. The premise is dumb. The writing is dumb. And the characters are especially dumb.

Nevertheless, I have watched every episode (some of them twice). So I guess The Walking Dead is like a golden retriever. A dumb animal that's fun to play with and keeps bringing the ball back.

Getting me to watch really isn't the hard part. As a lifelong Dungeons & Dragons fan, I'll watch anything about a band of multi-talented adventurers trying to survive in hostile territory. The Walking Dead is just The Lord Of The Rings ... in Atlanta.

I haven't read the books, so maybe I'm missing something. But I can't believe the premise, no matter how hard I try. The zombies are mindless. They don't bother to look under cars or behind doors. If you put a drop of blood on the ground, they stop to lick at it, instead of attacking the 180-pound meal right in front of them.

A band of raccoons would be more dangerous than a band of these zombies. Raccoons are faster and smarter, with better offensive weapons (claws and teeth) and much better defense (try killing a scurrying raccoon with a .45, with one shot). And yet our world hasn't been taken over by raccoons. So it's hard to believe that it would be taken over by the zombies portrayed in The Walking Dead. I can't even think of a dumb animal to compare them to, because evolution didn't make anything that dumb and harmless. Perhaps a drunken sloth on Valium.

In order to take over the world, zombies need an edge. Something that makes them scarier than the coyotes that steal chickens from my yard.
  1. The writers could have made them strong. They didn't.
  2. The writers could have made them fast. They aren't.
  3. They could have made them smarter than earthworms. They didn't.
  4. They could have given them improved senses, to hunt out fresh meat. They didn't.
  5. They could have made the disease spread easily. They didn't. Our heroes splash zombie blood all over themselves every day and don't get infected.
  6. They could have made the disease hard to detect. This is how diseases spread in real life. You can't tell who has HIV just by looking at them.
So we have a bunch of dumb slow weak zombies, that are easily identified (and whose victims are easily identified). It makes no sense that they could overtake a country with 2.9 million trained soldiers, 900,000 police officers, and more than 270 million guns in civilian hands.

The only way such a "threat" could bring on the apocalypse is if all humans were complete morons. Luckily for the zombies, the humans in The Walking Dead are just as dumb as they are:

Wednesday, February 22, 2012

The Final Republican Nominee

Photo by sfgamchick on flickr

There's a poll over on the Sports Mogul Forums, asking which Republican should be the next president.

The results:

CandidateVote Percent
Ron Paul30%
Rick Santorum13%
Mitt Romney9%
Newt Gingrich4%
"A potato"44%


If the Republican Party could nominate a potato, I'm sure they would. I think that was the logic behind Rick Perry entering the fray.

In all seriousness, it's hard to write negative ads about a potato.