© 2013 Michael Parkatti Zeuz2

Optimizing an NHL Roster: Edmonton Oilers Edition

One of the things that fascinates me about hockey is how some players seem to find chemistry together while others do not.  If you follow my game recaps, my player-with-player matrices try to tell the story of just that — they’re a microcosm of who had success together in a certain game, while who didn’t.  A coach really only has a few levers to pull in any given game.  One of the primary ones is which players to play together.  I’ve had a nagging feeling that if a coach concentrated on compiling his lines to maximize their efficiency, you could squeeze out a few extra percentage points of Corsi just by finding a team’s optimal chemistry.  This weekend, I’ve set out to prove just that.

I’ll again use the tenants of operations research, a discipline I laid out in more detail recently while optimizing the league’s divisional alignment.  My objective is to create a lineup which maximizes the average player-with-player Corsi of each line and each defensive pairing.  I’ll use integer mathematical programming, and use Excel to set up my calculations.

To start, I needed a massive player-with-player matrix to cover the entire season.  I completed this part of the analysis yesterday using stats from http://stats.hockeyanalysis.com.  To be included in my matrix, two players needed to have played at least 9 minutes of play together, good for about 10 shifts or so.  This doesn’t sound like a lot, but a very small minority of players are close to that — with half a season gone most of the roster has been able to play a decent chuck of time with each other.  The only data I need to add beyond this season was Ales Hemsky and Shawn Horcoff’s Corsi together, for which I used last year’s data as they hadn’t played enough time together this year to use.

So, what next?

  1. We have to set up a decision matrix that will allow my model to choose which players should play in which lineup spot.  It’s constrained to be binary, meaning a ‘1’ shows the model has selected a player in that lineup spot, and a ‘0’ meaning it hasn’t.
  2. We then need to set up a line combination table that tabulates the results from the decision matrix to show which players are on each line together
  3. Finally we need to set up a calculation table, that takes the data from the line combination table and the player-with-player matrix to display how each player has done with his proposed linemates by averaging the Corsi they’ve displayed together.  I then average the Corsi of each line and defensive pairing’s averages to come up a projection of how the model expects a line to perform.  My ultimate objective function is then one average of all of these averages, which I set the model to maximize.

I then used my Premium Solver Platform Excel Add-In to maximize this objective function (the average Corsi of the lines and defensive pairings) to find the optimal arrangement of players.  With 24 players included, the model would obviously leave 6 players out of its lineup to get to 18 skaters — we would be able to see which players are surplus to the roster.

I had to set the following parameters:

  1. I input positional constraints so that only certain players could be chosen for certain positions.  For instance, defencemen could only be chosen to fill a defensive spot on the roster.  Magnus Paajarvi could play either left or right wing.  Jordan Eberle could only play right wing.  Smytty could play basically anywhere.
  2. The first line needed to have an average Corsi higher than the 2nd line, etc.  This way would could get a sense of what the true ‘line’ order is in terms of who pushes play.
  3. I told the model that Justin Schultz had to be included in the lineup.  In early runs of Solver, it wanted to leave him out of the lineup due to a high Corsi shared by Potter and Nick Schultz.  Justin struggled with anyone away from Nick Schultz, so I constrained the model to say Justin had to play.
  4. Each player could only be picked once for any lineup spot, therefore Taylor Hall couldn’t play on two lines, etc.
  5. Each lineup spot needed to be filled.  We couldn’t just NOT have a fourth line, though I’m sure the model would be tempted to.

I’ll show you the results by table.


This is the decision table.  The blue cells are the ones I allowed the model to change to either 1 or 0.  Therefore the white cells are ones that were out of scope in that a player couldn’t play those positions.  You can also see the 1’s in this table where the model has selected a player to play.


Here’s the line table.  This allows my model to know who’s playing together on each line.


This table calculates how each player has done with his proposed linemates this year by using the season player-with-player matrix.  The averages of each line are in the bottom row.  The objective function that I maximized was the ‘Total Average’ cell, which is an average of the Line Averages.

All of this results in a proposed lineup of:


Right off, you can see that the model has left Petrell, Eager, Brown, VandeVelde, Potter, and Peckham off the roster from our original list — which is saying something if the optimal 4th line has a Corsi together of 43.1% and your bottom pairing has 44.7% together.

Not surprisingly, the top line stays intact and is the primary puck possession line on the team.  The second line sees Paajarvi play with Sam Gagner and Nail Yakupov.  Paajarvi has done well wherever he’s played, but has had the ability to elevate Sam Gagner’s play where it has lacked otherwise.  The return of Shawn Horcoff can’t come soon enough, as this proposed third line with Hartikainen and Ales Hemsky would certainly be able to take on some tough competition to shelter that 2nd line a bit.  The fourth line sees veterans Smytty, Belanger, and Jones just barely keeping their heads above replacement level.  With the forward depth of this team in tatters, that is literally the best we can do.

The defence pairings probably aren’t all that surprising.  The Schultz are paired together, along with Smid & Petry.  These two pairs have been mainstays all year, though their results haven’t exactly been fantastic.  For the third pairing, the model has chosen Ryan Whitney and Mark Fistric, whose percentage together actually is ahead of Smid and Petry’s.

So what kind of performance bump could this team see using this optimal lineup?  We’re currently dead last in even strength Corsi as a team, at 44.6%.  The model suggests quite a bit:


I’ve taken the Corsi’s of each line and then weighted them arbitrarily to reflect how much ice time they will receive.  The first line will have more time on ice to manifest their 54.4% Corsi than the 4th line will receive to show their 43.1%.

The potential team Corsi using this lineup is 49.5%.  Still not gangbusters, but good for 18th in the league.  It’s 4.9% higher than the current team is doing with the whacky line combos and sub-replacement level players drawing in.

We don’t have a contending team by any stretch of the imagination, but we could be a LOT better.  That is, if we believe in facts.


  1. Mac Sapintosh
    Posted March 10, 2013 at 1:22 pm | #

    Hey Micheal, awesome work, as usual. I think the lines make a lot of sense (except for of course for some reason you have left out Eager and Brown…?? #gritindex).

    I feel though there is a general fundamental flaw in this whole exercise and that is that it appears to me (and please correct me if I’m wrong) that zone starts have not been taken into account. I think Mirtle (IIRC) posted something the other day about how zone starts had a larger effect on CORSI than quality of opposition (although I imagine the two are related).

    It is probably very cumbersome and complex to work this factor into your equations and I certainly don’t have any constructive solutions but in the tradition of academics I felt I should point it out nonetheless.

    Keep up the great work. I will be happy to vote for you as the next GM once we kill Frankenstein’s monster. We DO get to vote, right?

  2. Michel
    Posted March 10, 2013 at 2:13 pm | #

    Great post as always Michael. I appreciate you putting in all this work to help educate us about the team using quality data.

    I do have some reservations though that echo those Mac expressed. Seems the guys who take mostly offensive starts show up repeatedly as better partners. Whitney is a great example of this. If you look at his usage chart, he’s arguably the worse performing d-man on the team. But he takes more off zone faceoffs than any other defenseman. So he ends up looking like a linemate that shares chemistry with a number of players when in fact they’re probably seeing their performance hold relatively steady when playing with him mostly because they tend to be starting in an easier location which helps offset some of his suckiness.

    In defense of a guy like Petrell, who I agree probably shouldn’t be in the NHL, he had a 30/70 off zone/def zone split this year. If the avg player’s split has been closer to 48/52, it’s very likely that anytime a guy was on a line with Petrell they were starting their shift pinned in their own end leading to a poor corsi.

    Without taking into account off zone starts, seems this methodology will be tempted to cheat by removing posessions that started in the defensive end to show an overall improved corsi.

  3. Michel
    Posted March 10, 2013 at 3:12 pm | #

    Hi Michael,

    I’ve pulled together some data to figure out whether the model’s results are being artificially inflated by off zone start rates.
    Specifically, I went to behindthenet and grabbed the minute distribution and off zone starts this season. I focused the information on 5vs5 play. To date, EDM has averaged 46.1 mins per game at 5vs5.

    Minutes have been allocated between the 4 lines roughly as follows:
    1st line – 15.33/gm
    2nd line – 13.78/gm
    3rd line – 10.98/gm
    4th line – 6.01/gm

    If we take the avg zone start rate so far this season for each of the players on your newly proposed lines, we get the following built in zone start %:

    1st line (kid line) – 55.2% off zone starts
    2nd line (Gagner, MPS, Yak) – 53.4%
    3rd line (Horcoff, Hartski, Hemsky) – 43.2%
    4th line (Belanger, Smyth, Jones) – 40.8%

    Weighting the above against their minute distributions, the model appears to be building in a team zone start rate of 49.9% off zone to 50.1% def zone. Comparing that figure to EDM’s actual 5vs5 start rate so far this season, we see that to date EDM has taken about 47% of its starts in the off zone.

    So the current team, when taking 47% of starts in the off zone was able to put up a 44.6% corsi (constrained by injuries preventing the coaching staff from optimizing the lineup each night).

    Your model’s proposed solution projects to yield a 49.5% corsi if given a 49.9% off zone start rate (and never being constrained by injuries).

    If we re-frame the results in that context, do you think there’s as much room for improvement through lineup tinkering?

  4. Michel
    Posted March 10, 2013 at 4:30 pm | #

    Correction to the above: I recalculated minute distribution when I see you had actually specified the minute allocation. Under your minute allocation, the built-in off zone start rate is 49.1% (not 49.9%).

  5. Michael Parkatti
    Posted March 10, 2013 at 4:49 pm | #

    Interesting comments all, thanks for your input…

    As for zone starts, yes this data does not control for zone starts. Do you have the link to Mirtle’s piece? I’ve been thinking about trying to deduce what effect ZS and QualComp have on a player’s Corsi rate at some point. My hunch is that unless zone starts are appreciably bad, say below 40%, it shouldn’t have much impact. So the relationship may be nonlinear in that regard. I will admit this analysis doesn’t control for that, and in the future would be an obvious enhancement if such a methodology could be found and proven.

    Michel — thanks for pulling those numbers together. The thing I think about is this — did the team zone starts impact team performance, or does team performance impact the team zone starts? If you find lines that maximize chemistry to increase team Corsi, you’ll naturally be starting more often in the off zone. I’d also caution against using the ice time weightings as seen to date simply because the 4th line has been such a gong show for so long, Krueger was forced to use it sparingly. With Horcoff back and Belanger back where he belongs on the 4th line, I’d expect the distribution to be more narrow, hence the arbitrary weightings I used.

    I think this points out important things. 1. that using sub-replacement level players like Eager and Petrell (regardless of ZS) will result in bad results. It’s hard to find any player that plays better with those players than away from them. These players don’t drive the bus, they sit wayyyyy at the back. Identifying which players are surplus is important. 2. distinct patterns in chemistry have been shown, and the Oilers have been slow in reacting to them. Forcing Hall to play with Gagner, for instance. At some point you need to cut your losses and go with the pairings that for whatever reason seem to be working.

    And if you want to vote for me to be GM, I’ll pass the collection plate around 😉

  6. Sean
    Posted March 10, 2013 at 5:51 pm | #

    I’d say this passes the smell test. It’s about the same lineup that most sane pundits have been hoping for, maybe with Yak and Hemmer switched but I doubt that makes much difference.

    With the 4th line as ugly as it is, there’s no way they should be out against the other teams 1/2 lines, even on the road. I’d bet that alone brings the 43% up a few points.

  7. Michel
    Posted March 10, 2013 at 5:54 pm | #

    I think you’re right that having better players with more chemistry is likely to improve the team’s overall zone start split but I’m not sure that on an individual by individual basis we can assume zone starts are being driven by their play. If you look at most enforcers in the NHL, they have very high off zone start rates. I would assume that’s because the coach does not want to see his team in a situation where they’re relying on a “truculance” line to keep the puck out of the net. We also see this phenomenon with young players, and offensive specialists. They’re deployed more in the off zone to either leverage their expertise, or to shelter them from having to be relied upon too much for their defensive acumen.

    The stat that I would point you towards as further evidence is off zone finish rates. I would think if a player is really forcing himself to start more in the off zone by pressuring the opposition and winning the puck battles, they should also be leaving their teammates in a position to start the next shift in the off zone as well.

    And yet if you look up and down the Oilers lineup, most players that started a disproportionate number of their shifts in the defensive zone tended to finish their shifts more frequently in the off zone. On the flip side, the majority of players with very high off zone start rates have tended to finish their shifts in the def zone.

    For that reason I tend to think the data is more indicative of how coaches deploy their players than how the players themselves are driving possession.

    I would love to see someone run some regressions to figure out the relationship between corsi rel and off zone starts so we can make an adjustment and truly see which players are outperforming expectations.

    • Michael Parkatti
      Posted March 10, 2013 at 6:06 pm | #

      I’ve got a concept in my backlog to do just that — run regressions to see the relationship between the ‘difficulty’ variables and their relcorsi.

      Zone finish is one of those weird stats where guys who start in the offensive zone always tend to end in the offensive zone less often, and vice versa. I’ve always been suspicious of that relationship.

      Petrell’s corsi is just so bad, I can’t see all of it being explained by difficulty factors. Having a relcorsi of 45% might be explained away, but 28.4%? I just don’t see it…

  8. Mac Sapintosh
    Posted March 10, 2013 at 6:27 pm | #

    Sorry Micheal, I don’t have a link, I wish twitter had a more useful search function. It might have been Desjardin or even Eric. I just remember reading it and thinking ‘wow, really?’ But when measuring possession by shots at the net, a zone start should intuitively inflate or deflate that metric. Start in the o-zone? throw the puck on net, not a lot of game play necessary. D-zone? Gotta win the draw, clean breakout, get in the zone, hopefully by carrying it, if not, dump in, regain possession, gain clean possession, set up a shot. Again, apologies for no link.

    Would also like to add that anytime we see ‘chemistry’ between two players I would suspect the explanation is ‘both good players’ or ‘sample wonkiness.'(Potter) I don’t believe chemistry (the idea that a particular playing style make certain pairings better but not others ) is a thing.

    Rob Brown, Mario Lemieux etc.

  9. Michel
    Posted March 10, 2013 at 9:34 pm | #

    Thanks Michael. Looking forward to seeing what you come up with in your regression analysis.

    Not trying to defend Petrell btw. Just suggesting that zone start rates make his bad stats look truly outrageous. I still think he’s probably an AHL player.

    Simplest way to see how the start rates may have affected him is to compare to last year. Last season he started 48.7% in the offensive zone and produced a corsi rel of -16.1. This season he has started 28.4% in the off zone and produced a corsi rel of -30.7. He has basically doubled up on the opportunities ceded to other teams by being pinned in his own end more often.

    Now either way, the data points suggest a player that struggles to stay above water in the NHL. But completely ignoring a variable that seems to have a very direct relationship on corsi rel might lead to less than optimal conclusions.

    Anyhow, even without the off zone starts, your analysis provides us with insights we didn’t have before so I thank you for putting in all the time that you do!

  10. gcw_rocks
    Posted March 11, 2013 at 8:13 am | #

    This is a fantastic model, potential enhancements not withstanding. Someone needs to forward this to Krueger. I mean, really, some version of this type of analysis should be on the wall of every NHL head coach’s office.

  11. handagith
    Posted March 11, 2013 at 11:19 am | #

    Great work on this. I’m always happy to see someone bust out a solver model. A couple comments:

    You can get the zone-start adjusted corsi or fenwick from the same stats.hockeyanalysis.com site. The zone-start adjustment only includes events that occur at least 10 seconds after a faceoff (a technique pioneered by Eric Tulsky). You lose some sample size, but the tradeoff is worth it. I believe each 1% change in ZS equals 1 corsi event (my memory is foggy on this one). QoC is not as important as the variance between competition is much smaller. hockeyanalysis.com also has an option to remove score effects by limiting the corsi or fenwick to game states within 1 goal. Again, you lose some sample size, but it’s worth a test. I suspect these two changes in your input data would rearrange things on the bottom half of the roster.

    You might find a different deployment if you include the TOI weighting in the objective function. I.e., the model might choose to put more eggs in the higher lines and throw the fourth line to the wolves. Then you wouldn’t have to weight the corsi after the fact to find the true result.

    Finally, if you find your model getting a bit unwieldy, google open solver. It’s free, and as long as you keep things linear, it scales as good if not better than the premium one.

    Again, keep up the great work.

    • Michael Parkatti
      Posted March 11, 2013 at 1:13 pm | #

      Thanks for the great comment, much appreciated.

      I hadn’t read into how H-A.com implements their zone adjustment, I was worried it was some arbitrary modifier, so to learn it’s just restricting the sample size slightly is really interesting. My chief concern when compiling the player-with-player matrix was having the largest sample size possible, but taking away a few seconds of zone-dependent events seems to make sense.

      I made a conscious decision not to use CorsiClose because of the sample size concerns. Of course, the Oilers have been in a lot of ‘close’ games/situations, but those times when they’re not is when Krueger tends to try out new lines and pairings to shake things up a bit IMO. Of course, then you have to worry about score effects distorting things, so it’s a weird little catch-22. But it would be interesting to run it both ways.

      Very interesting suggestion to bake the time-on-ice percentages into the objective function itself. The model may very well decide on a less-consistent line deployment if the 4th line’s ice-time is minimal. As an aside, the reason I used arbitrarily-chosen TOI was because the usage of the 4th line earlier this year during Horcoff’s injury has probably not been representative of how Krueger would use them with Horcoff in the lineup, ie a 4th line centred by Belanger will get more icetime than one centred by VandeVelde. I’ll be keeping track of how he ices lines now that Horcoff is back.

      Open Solver! I love it, my trial version of platform solver is expiring and the native Solver application just can’t handle complexity like this. How does Open Solver handle integer constraints? To me that was the major benefit of using platform versus basic Solver. It’s been a few years since my university days now, I’m not up to speed on all the hip new tools ;)…

      thanks again, peer review can only make these little studies even better.

  12. Richard
    Posted March 14, 2013 at 11:59 am | #

    It would be interesting to run this analysis for each NHL team for this season and see the difference between their current corsi and the potential corsi using what you determine is their “optimal” line up. Perhaps a sign of a terrible coach is one where the difference between potential and actual is quite large.

  13. Doogie2k
    Posted March 14, 2013 at 4:25 pm | #

    Fantastic stuff, Michael.

    One idle thought: I wonder how much of 4L’s Corsi failure is due to the fact that ALL of them have been saddled with suckbags as the “third” on their pairing. I wonder if there’s enough of a sample to be able to separate out the effects of Eager et al. on everyone else’s numbers. I’d bet Jones-Smyth-Belanger, in a live-fire exercise, would put up more than a shade better than 43% Corsi as a line, though I admittedly have little to back that up.

  14. Posted March 15, 2013 at 10:36 pm | #

    Great Work Michael.

    I’ll just add that 10min TOI is a tiny sample, by my calculations, it’s something like (10/(180+10) =) 5% Talent, 95% luck at the NHL level (Based on 12-13 individual Corsi variance). It might be worthwhile to regress Corsi% to the mean based on TOI, as so much variance can occur depending on total TOI for each pairing.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>