Monday, January 13, 2014

About Monte Carlo Simulations

Over on Stats Intelligence (a blog you should read if you don't already), there is a complaint today about the silliness of Monte Carlo simulations.  I have something to say about that, but before I do so, let me give a quick overview of Monte Carlo methods for those who might not be familiar with the approach.

The basic idea behind the Monte Carlo method is that you have a complex simulation of some process.  The outcome of the simulation depends upon some number of factors that you don't know with certainty, although you might be able to guess a likely range for them.  Also, these factors interact in complicated and non-obvious ways, so that a slight tweaking of a factor might lead to an entirely different outcome.  Using this sort of a simulation for prediction is pretty hopeless, because it's too sensitive to your guesses about these factors.  If you change your guess a little bit, the outcome changes.

For example, you might have a computer program that simulates an entire football game down-by-down.  Each down you select an offensive play, a defensive set, you choose which receiver to pass the ball to, etc.  You have random factors to cover things like corner backs falling down, etc.  This might make a fun game (think John Madden Football) but running Seattle vs. San Francisco one time and using that to predict next weekend's outcome is obviously foolish.

The idea with the Monte Carlo method is to "wash out" this sensitivity by running the simulation many, many times with a sampling of random values for the factors within their likely ranges.  Then you can sum up over the outcomes to get a percentage estimate for each outcome.  For example, you run John Madden Football ten thousand times and Seattle wins 64% of the time.

Over on Stats Intelligence, Jeff complains today about the arbitrary number of iterations people claim for their Monte Carlo simulations to give them a veneer of accuracy and in-depth analysis.  And I agree with him completely on this issue -- it's ridiculous to see "50,000" runs when you know that's 100x more than necessary.

But my complaint is different.

Over at the Harvard Sports Analysis blog (another blog you should read if you don't already), Julian Ryan has a posting which uses a Monte Carlo approach to estimate Harvard's chances of winning the Ivy League championship in basketball.  (By the way, he did 50,000 simulations :-)  In his simulations, he estimated Harvard's chance to win each game based upon Ken Pomeroy's ratings.

This sounds like a sophisticated approach that will give new insights into the Ivy League competition. 

But here's the thing.  The outcome of each simulated game is based upon exactly one factor -- a percentage derived from the ratings of the two teams.  So when Harvard plays Yale, you plug the ratings into a formula and out comes the likelihood of a Harvard victory -- 74%, say.  Now let's imagine we "simulate" that game 50,000 times by rolling a 100-sided die and giving Harvard a victory if the number is 74 or below.  At the end of this excruciating exercise, guess what percentage of the simulated games Harvard has won?

Yes, 74%.

IMPORTANT

The Monte Carlo method doesn't provide any value if your simulation is based upon a few fixed, known factors.

If you just have a few fixed factors, you can calculate the likelihood of an outcome directly.  You don't need to use a Monte Carlo approach.  If you look at Julian Ryan's results, you'll see that Harvard is the most likely winner of the Ivy League, followed by Princeton and then Columbia.  Is that a big insight from the Monte Carlo approach?  No.  That's simply the order of the teams in the Pomeroy ratings.  If you look at the expected number of wins for Harvard, you'll see it looks like a normal distribution.  Well, it should, because that's what you get when you take the mean of a bunch of random outcomes.

Now to be fair to Mr. Ryan, he's not the only one to do this sort of thing.  In fact, Ken Pomeroy uses Monte Carlo simulations to predict conference results.  (With, not surprisingly, the same results for the Ivy League.)  The only defense I can offer is that a Monte Carlo simulation is a fairly straightforward way to estimate a number that can be hard to calculate.  If I tell you that Harvard has a 94% chance of winning when it hosts Yale, and a 74% chance when playing at Yale, then the chance that Harvard goes 2-0 is .94x.74, the chance that they go 1-1 is .94*.36 + .06*.74 and the chance that they go 0-2 is .06*.36.  It gets increasingly hard to calculate the likelihoods as the number of teams and games goes up.

(Although in a league that plays home-and-home between all teams, this is all unnecessary.  The chances of winning the league are directly proportional to the strength ratings!)

In summary:  For a simple simulation based upon a few fixed factors, the Monte Carlo method may be useful for estimating hard-to-calculate numbers but doesn't offer any additional insight beyond the known factors.

Top Twenty (1/13)

1 Oklahoma St. 34.19
2 Arizona 33.23
3 Louisville 33.08
4 Iowa St. 32.75
5 Iowa 32.66
6 Ohio St. 32.63
7 Creighton 32.19
8 Kentucky 32.13
9 Villanova 32.12
10 Wisconsin 31.66
11 Duke 31.65
12 Syracuse 31.65
13 Arkansas 31.5
14 Michigan St. 31.44
15 UCLA 31.43
16 Kansas 31.4
17 Pittsburgh 31.32
18 Michigan 31.31
19 Cincinnati 31.01
20 Arizona St. 30.91
Big upward moves this week were Wisconsin +7, Kansas +5, and Iowa, UCLA and Pittsburgh all jumping 4 spots.  Downward:  Gonzaga -8, Arkansas -7, Michigan -6.  Oklahoma State continues to cling to the top spot with Arizona and Louisville closing fast.

PREDICTIONS

#15 Kansas @ #8 ISU:  ISU by 7

Should be a straightfoward ISU win.
#3 Wisconsin @ Indiana:  Wisconsin by 3

I'm surprised to see this close a prediction.  The PM has Indiana at #46.
#13 Kentucky @ Arkansas:  Arkansas by 5

The PM thinks more of Arkansas than most observers; this will be a good test for them.
#11 tOSU @ Minnesota:  tOSU by 1.5

The Gophers get another shot at a big win.  They played MSU to OT before losing -- can they pull off something against Ohio State?
#25 UCLA @ #21 Colorado:  Colorado by 4

The PM can't factor in the Dinwiddie injury, so this might be closer than predicted.  Or UCLA might end up losing twice this week -- Utah is better than most people know.  (4 losses by a total of 9 points, including an OT loss to then #10 Oregon.)
#22 Pittsburgh @ #2 Syracuse:  Syracuse by 4

Another game where I'd expect a bigger margin.
#25 Oklahoma @ #12 Baylor: Baylor by 7

I'm not sure why either of these teams are ranked, although the PM has Baylor just outside the top 25.  That will change after Baylor loses to Texas Tech earlier in the week.
TOSS-UP OF THE WEEK

#9 Oklahoma St @ #15 Kansas:  <1 point

It's going to be tough for Oklahoma State to win at Kansas.
BLOWOUT OF THE WEEK
TCU @ #9 Oklahoma St: Oklahoma St by 28

The Cowboys pull of the rare two-fer by appearing in both the Toss-Up and the Blowout.

Tuesday, January 7, 2014

Top Twenty (1/6)

1 Oklahoma St. 34.72
2 Louisville 33.68
3 Arizona 33.26
4 Ohio St. 33.08
5 Iowa St. 33.05
6 Arkansas 32.66
7 Kentucky 32.15
8 Iowa 32.14
9 Villanova 32.12
10 Creighton 32.05
11 Duke 31.99
12 Michigan 31.65
13 Gonzaga 31.39
14 Michigan St. 31.27
15 Syracuse 31.26
16 Cincinnati 31.21
17 Wisconsin 31.17
18 Arizona St. 31.15
19 UCLA 30.97
20 Colorado 30.94

Oklahoma State lost ground in the #1 spot but not enough (yet) to fall behind Louisville.  Big movers this week were Gonzaga shooting up from below the Top Twenty to #13 and Arizona St. dropping 8 spots to #18.  Gonzaga still hasn't played any really good teams, but has won its last three games by a minimum of 22 points.    Arizona State meanwhile lost a game to #98 Washington and was penalized accordingly.  Also new to the Top Twenty are Michigan State -- vaulting almost as far as Gonzaga on the basis of the solid win against Indiana -- and UCLA -- being rewarded for demolishing USC and also I give them an extra point (*).   Cincinnati and Wisconsin continue to climb steadily, while Arkansas and Colorado are sinking.
(*) Just kidding.

TOSS-UP OF THE WEEK
#3 tOSU @ #5 Michigan State:  Toss-up

The toss-up of the week is also the first AP Top-25 matchup of the week.  A slight hair of an advantage goes to MSU in what should be a typical BigTennish contest.
#7 Baylor @ #9 Iowa St:  ISU by 12

The PM has ISU just on the edge of the really top-notch teams and Baylor down at #30, so it's no surprise it predicts an easy home victory for ISU.
#23 Illinois @ #4 Wisconsin: Wisc by 9

Illinois beat Indiana last week, so they're the ranked team, but not nearly as good as Wisconsin.
#1 Arizona @ UCLA:  Arizona by 2
The PM believes in UCLA, and home court is going to be worth something, but Arizona should still manage to win this game.
#24 Memphis @ #12 Louisville: Louisville by 18

Memphis's loss to Cincinnati suggests that even at #24 the AP is over-rating them.

Minnesota @ #5 MSU:  MSU by 5

This game might be closer than expected, and MSU may be down if they lost to tOSU.  Go Gophers!
#25 Kansas St @ #18 Kansas: Kansas by 9

Should be a routine win for Kansas, but they have a trap game earlier in the week @ Oklahoma that they might lose.
THE AUBURN CONSOLATION GAME OF THE WEEK
#21 Missouri @ Auburn:  Missou by 2

If Auburn can pull off the upset, it will be some consolation for the Auburn fans grieving about Monday night's loss.
THE BLOWOUT OF THE WEEK
Northwestern @ Iowa: Iowa by 22
Not a lot of blowouts predicted for this week.

Monday, December 30, 2013

Top Twenty, Predictions (12/30)

Prediction Machine's Top Twenty



1 Oklahoma St. 35.8
2 Louisville 34.0
3 Arizona 33.1
4 Arkansas 32.7
5 Ohio St. 32.7
6 Iowa St. 32.6
7 Iowa 32.4
8 Kentucky 32.2
9 Villanova 31.9
10 Arizona St. 31.9
11 Duke 31.7
12 Creighton 31.6
13 Michigan 31.4
14 Syracuse 31.1
15 Kansas 31.0
16 Pittsburgh 30.8
17 Colorado 30.8
18 Oregon 30.8
19 Cincinnati 30.7
20 Wisconsin 30.6

The big mover this week was Syracuse jumping up 6 spots to #14 based on the solid win against Villanova -- who dropped 5 spots.  Arkansas and tOSU both moved up 3 spots.  I'm not sure why in either case, although tOSU did have a win over ND last week.  Oregon dropped 3 spots after squeaking out an OT win over BYU at home.

Predictions

Not a lot of interesting games this week, although there are 3 Top 25 vs. Top 25 matchups next Sunday for some reason.

#3 tOSU vs. Purdue:  tOSU by 12

HCA won't be enough for the Boilermakers

Indiana vs. Illinois:  Indiana by 1

In the running for squeaker of the week.  If Indiana wins at Illinois and then upsets MSU later in the week, they'll probably be ranked next week.

St. Mary's vs. #24 Gonzaga: Gonzaga by 4
Good chance for an upset here -- Gonzaga is probably over-ranked.  A win by 4 at home is basically saying you're even with the visiting team.

#9 Duke vs. Notre Dame: Duke by 3
Duke outperformed last week, but this might be a trap game for them.

#5 MSU vs. Indiana: MSU by 2
Indiana's chance to get ranked...

#22 Iowa vs. #4 Wisconsin:  Toss-up
Coin Toss of the Week.  The PM favors the Badgers by a tenth of a point, but that's down in the noise.

UNI vs. #10 Wichita State:  Wichita State by 5
UNI's probably not good enough to win this on the road.

#12 Oregon vs. #21 Colorado:  Colorado by 3
The PM has these teams as nearly identical strength, so this goes to Colorado playing at home.

#20 SDSU vs. #16 Kansas:  Kansas by 4.5
The PM's not nearly as fond of SDSU as the AP -- it has them down around #60 in the country -- so this should be a pedestrian win for Kansas.

BLOWOUT OF THE WEEK

Robert Morris vs. #7 Oklahoma State:  OkSt by 30
The PM effectively caps predictions around 30 points MOV, but this might stray into the 40 point range.

Monday, December 23, 2013

Top Twenty (12/23)

Now that the Redskins are dead and buried, I'm turning my attention more to college basketball.  Here's the season's first Top Twenty from the Prediction Machine.

Top Twenty


1 Oklahoma St. 35.8
2 Louisville 34.6
3 Arizona 32.8
4 Villanova 32.6
5 Iowa St. 32.6
6 Iowa 32.4
7 Arkansas 32.3
8 Ohio St. 32.1
9 Arizona St. 32.0
10 Kentucky 31.7
11 Creighton 31.3
12 Duke 31.3
13 Michigan 31.1
14 Kansas 31.0
15 Oregon 30.9
16 Pittsburgh 30.8
17 Colorado 30.6
18 Florida St. 30.4
19 Wisconsin 30.3
20 Syracuse 30.3

Some early-season shakeout still going on in the Top Twenty.  Oklahoma State and Louisville are head-and-shoulders above the rest of the nation.  Oklahoma State lost some ground this week to Louisville despite a solid win over Colorado.

Predictions


There's a dearth of interesting games until next Saturday.

#8 Villanova at #2 Syracuse:  Nova by 4
The PM has Nova at #4 and Syracuse at #20, so don't expect Syracuse to have an easy time of it.  Home court advantage is worth a lot, though, so it won't be a big surprise if Syracuse wins this game.

#6 Louisville at #18 Kentucky: Louisville by 8.5
The PM thinks better of both teams than the AP, but Louisville (and OKSt) is head-and-shoulders above the rest of the Top Twenty, so the PM thinks they'll win comfortably at Lexington.

Providence @ #23 UMASS!!!:  UMass by 1
Good chance for an "upset" in this game.

#25 Missouri @ N.C. State:  Mizzou by 1
Another good upset possibility.

 

Blowout of the Week

 

Wisconsin over Prairie View A&M by 29

 

Coin Toss of the Week


Boston U @ St. Joseph's


Thursday, October 24, 2013

Local Regression

The Prediction Machine uses a linear regression to form its predictions.  A linear regression works by calculating a straight line equation (hence "linear") that best fits the observed historical data.  That looks something like this picture:
Given a new X we use the blue line to predict a value for Y.  The Prediction Machine isn't two-dimensional like this illustration -- it has dozens of inputs rather than just one -- but this gives you the general idea of how it works.

It turns out that a linear regression works pretty well for the Prediction Machine.  But I've wondered whether there aren't "special cases" hidden in the data where the equation that best fits all the data doesn't work well for the special cases.  For example, you might think that teams that are very good at getting offensive rebounds could be predicted more accurately with a slightly different equation.  If you could pick out those cases and use a different linear regression, overall accuracy would improve.

There are a number of different approaches to doing this.  One is to use a more complex regression, so that the "blue line" can bend more flexibly in different regions of the prediction space.  For example, you can use a polynomial regression:

But a polynomial regression still bends "smoothly" and is limited in how many times it can bend.

Another approach is to predict a game's outcome based upon its nearest neighbors, as I talked about here.  The shortcoming with this is that the prediction is based upon the average of all the nearby neighbors -- which might not be the right estimation.  A more sophisticated model (such as a linear regression) might work better.

Local regression is a modeling technique that combines nearest neighbors with regression.  It works by finding the nearest neighbors to the example you want to predict, creates a linear regression using just those neighbors, and then predicts the example using the linear regression.  If your data really has "neighborhoods" that act differently, this should do a better job of prediction.

Local regression was recently added to RapidMiner so I took the opportunity to apply it to the Prediction Machine to see if it would improve performance.

The results were disappointing and/or enlightening, depending upon your perspective.  Performance of localized regression was much poorer than a linear regression for small numbers of neighbors.  It wasn't until the number of neighbors was greater than 2000 that its performance started to approach the performance of the linear regression.

This confirms earlier experiments suggesting that there aren't localized "neighborhoods" within the NCAA basketball data where we can improve performance by treating them differently.  The factors that predict performance seem to apply equally across the whole spectrum of college teams.

Wednesday, October 2, 2013

2014-2015 Schedule Available

The Prophet isn't completely awoken yet from his off-season hibernation, but is rousing long enough to mention that ESPN recently posted the first schedule of games for the season.  They don't seem to have locations yet for the neutral-site games and there are probably missing games.  I've posted the scraped file to the Data page.

Looking back, I see the Prediction Machine got the participants in the final games of both the NIT and the NCAA tournaments correct, and predicted all of the Final Four games correctly.