Game Score Introduction
The 2022-2023 PHF formally kicked off its season last weekend and, in a desire to produce more PHF analytics content, I began working on automated Game Score by Player reports for each team and player. Game Score is an idea that’s been around for a while in the PHF/NWHL, dating back to work from Shawn Ferris in 2018 and Mike Murphy in 2019.
As I perused the boxscores from the opening weekend games, I noticed that there was more data available than I expected, including goals, assists, shots (on goal, blocked, etc), blocks, penalty minutes, faceoffs, and even giveaways/takeaways. With this relative wealth of data, I wanted to A) re-work game score and B) make pretty charts!
I took a similar path to Mike and Shawn for this version of game score, essentially taking those aforementioned events and taking their occurence relative to goals. For example, there were 334 goals
in the PHF in 2022 and there were 3604 shots_on_goal
, which results in a shots_on_goal
weight of 0.095. That process is repeated for all those stats, with some (giveaways, penalty minutes, shots blocked) being given a negative weight because they are “bad” events. With Game Score, a higher number is better and it is intended to be roughly on the same scale as points on a player basis.
The data for this project fastRhockey, which I created to make PHF data easily available. The charts have been automated using a BATCH script in conjunction with R to automate finding the games for the day and tweeting out the resulting graphics.
Game Score Weights
The weights for Game Score are split into four components: Offense, Defense, Faceoff, Penalty. In the table below, you can view the weights for the 22-23 season, as well as the component that each stat falls into.
With these weights, you can run a players boxscore data through a function that uses these weights multiplied against their count data to produce their game score. It’s a very quick and repeatable process and easily automated postgame.
Once Game Score
has been calculated, it’s time for pretty plots to be created! You can find all the reports from this weekend here, but I’ll walk through the report for the Minnesota Whitecaps in their 2-3 loss to the Toronto Six.
Example
There’s a lot going on here, so let’s walk through it step-by-step. The players are sorted by total game score, so the players with the highest total are at the top (Jonna Albers) and the lowest is at the bottom (Sydney Baldwin). Each player’s actual game score is then positioned as text next to their bars, indicating their overall game score value.
What’s really fun about this chart is that I break the combined game score into its components to represent HOW a player arrived at their total value for a game. Did they have a stellar offensive game? Did they play defense incredibly well? Was their value boosted by a crazy faceoff game? Did they tank their value by spending a ton of time in the penalty box? All those questions are answerable with this report.
Let’s take Liz Schepers since she did a little bit of everything in this game.
Her overall Game Score was +0.46, but how did she get there? Well, she provided a TON of value offensively AND defensively, accruing +1.19 oGS and +0.42 dGS thanks to scoring one goal, taking two shots on goal, and blocking one shot. She did not record a takeaway, a giveaway (which is how a lot of skaters lose value) or have a shot blocked. On offense and defense, her only contributions were positive.
Alas, that trend did not hold true on fGS or pGS. Schepers went won five faceoffs and lost nine on Sunday; given that a faceoff win and faceoff loss are roughly equal value, she essentially gets dinged for losing four faceoffs, which comes out to -0.42, wiping out her defensive contributions in one fell swoop. She additionally spent two minutes in the penalty box thanks to a Holding infraction, further hurting her overall contribution.
All in all, Schepers was clearly the most hurt by the penalty minutes that she took. She made a ton of offensive and defensive contributions, but she probably shouldn’t take 14 faceoffs for the Whitecaps moving forward, though their other main option, Ashleigh Brykaliuk, who took 23, won 12 and lost 11 (as an aside, the only stats that Brykaliuk recorded was that faceoff record so maybe she’s supposed to be their faceoff expert?).
Additionally, the chart includes a player’s Shots on Goal (SOG), Giveaways (Gv), and Takeaways (Tk) from that game on the right-hand side, as almost a “triple-slash line” for players, just to give a quick overview at some more process-based stats, rather than points or something (in reality, I included those because I needed something on that side to center titles/legends/etc because I couldn’t center them otherwise…).
Next Steps
The main goal of this writeup and v1 of this updated Game Score is to get something out there. It is by no means perfect and has a lot of revisions already in the work.
First, I plan to move giveaways
into the oGS
component. I originally had it in dGS
to balance out takeaways
, but it makes so much more sense in oGS
.
Additionally, I need to do much more detailed exploration of how penalty
and shots_blocked
should be assigned and what weight they deserve. Both are inherently negative events, but I think that they may be too heavily weighted in the current configuration. On the penalty end, I think there may be some sort of scaled penalty weight I can create, where just a minute or two of penalty time isn’t terribly punishing, but ten to fifteen (or ejected) has a much larger effect. It’s one of those things that having Time on Ice (TOI) data for would be a huge help, but beggars can’t be choosers.
For shots_blocked
, I am interested in doing some research to see if shot on goal rates spike shortly after a blocked shot, like if the richochet provides more offensive opportunities. If so, it’s possible that A) shots blocked should have a POSITIVE rate or B) that they should at least be less impactful.
Furthermore, I hope to be able to explore some different methods of deriving Game Score and its weights, specifically as to whether some sort of regression approach to deriving weights. There are a few ideas percolating and floating around in my head and we will certainly see which of them make it to paper.
And, of course, because this is the PHF, we are at the mercy of the scorekeepers for each team and game to properly record the events for each game. I’ll be trying to keep an eye on if there are any specific discrepancies that are consistent across a specific home arena, but we will make do.
What About Goalies
Well, goalies are weird. And, with the quality/type of data we have available for the PHF, there’s not a whole lot to do. I’m not implementing a new box score approach because I think Mike’s goalie game score (Goalie Game Score = (.15*SV) – GA
) is already pretty good. Personally, I am working on a few new ideas re: measuring goalies, but they’re not finished yet, so you’ll have to stay on the edge of your seat until I get there.
LS0tDQp0aXRsZTogIlBIRiBHYW1lIFNjb3JlIHYxIg0KYXV0aG9yOiAiQmVuIEhvd2VsbCINCmRhdGU6ICIxMS84LzIwMjIiDQpvdXRwdXQ6DQogIGh0bWxfZG9jdW1lbnQ6DQogICAgaGlnaGxpZ2h0ZXI6IG51bGwNCiAgICB0aGVtZTogImZsYXRseSINCiAgICBjb2RlX2Rvd25sb2FkOiBUUlVFDQogICAgIyB0b2M6IHRydWUNCiAgICAjIHRvY19mbG9hdDogdHJ1ZQ0KLS0tDQoNCmBgYHtyIHNldHVwLCBpbmNsdWRlPUZBTFNFfQ0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGVjaG8gPSBGQUxTRSwNCiAgICAgICAgICAgICAgICAgICAgICB3YXJuaW5nID0gRkFMU0UsDQogICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSA9IEZBTFNFLA0KICAgICAgICAgICAgICAgICAgICAgIGZpZy5hbGlnbiA9ICJjZW50ZXIiKQ0KDQojIGxpYnJhcnkodHdlZXRybWQpDQpgYGANCg0KKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQoNCiMgR2FtZSBTY29yZSBJbnRyb2R1Y3Rpb24NCg0KVGhlIDIwMjItMjAyMyBQSEYgZm9ybWFsbHkga2lja2VkIG9mZiBpdHMgc2Vhc29uIGxhc3Qgd2Vla2VuZCBhbmQsIGluIGEgZGV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CiAgICAgICAgICAgICAgICBibG9ja3Nfd2VpZ2h0LCB0YWtlYXdheXNfd2VpZ2h0LCBnaXZlYXdheXNfd2VpZ2h0LCANCiAgICAgICAgICAgICAgICBmYWNlb2Zmc193b25fd2VpZ2h0LCBmYWNlb2Zmc19sb3N0X3dlaWdodCwgDQogICAgICAgICAgICAgICAgcGVuYWx0eV9taW51dGVzX3dlaWdodCkgJT4lDQogIGRwbHlyOjptdXRhdGUoc2hvdHNfYmxvY2tlZF93ZWlnaHQgPSAtc2hvdHNfYmxvY2tlZF93ZWlnaHQsDQogICAgICAgICAgICAgICAgZ2l2ZWF3YXlzX3dlaWdodCA9IC1naXZlYXdheXNfd2VpZ2h0LA0KICAgICAgICAgICAgICAgIGZhY2VvZmZzX2xvc3Rfd2VpZ2h0ID0gLWZhY2VvZmZzX2xvc3Rfd2VpZ2h0LA0KICAgICAgICAgICAgICAgIHBlbmFsdHlfbWludXRlc193ZWlnaHQgPSAtcGVuYWx0eV9taW51dGVzX3dlaWdodCkgJT4lDQogICMgaGVhZCg4KSAlPiUNCiAgcmVhY3RhYmxlKGRlZmF1bHRQYWdlU2l6ZSA9IDI1LA0KICAgICAgICAgICAgc3RyaXBlZCA9IFRSVUUsDQogICAgICAgICAgICAgICAgICAgICAgI2JvcmRlcmVkID0gVFJVRSwNCiAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q29sRGVmID0gY29sRGVmKA0KICAgICAgICAgICAgICAgICAgICAgICAgICBhbGlnbiA9ICJjZW50ZXIiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5XaWR0aCA9IDEwMCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyQ2xhc3MgPSAiaGVhZGVyIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgc29ydE5BTGFzdCA9IFRSVUUsIGhlYWRlclN0eWxlID0gbGlzdChmb250V2VpZ2h0ID0gNzAwKQ0KICAgICAgICAgICAgICAgICAgICAgICksDQogICAgICAgICAgICAgICAgICAgICAgdGhlbWUgPSByZWFjdGFibGVUaGVtZSgNCiAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyU3R5bGUgPSBsaXN0KA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiY6aG92ZXJbYXJpYS1zb3J0XSIgPSBsaXN0KGJhY2tncm91bmQgPSAiaHNsKDAsIDAlLCA5NiUpIiksDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiJlthcmlhLXNvcnQ9J2FzY2VuZGluZyddLCAmW2FyaWEtc29ydD0nZGVzY2VuZGluZyddIiA9IGxpc3QoYmFja2dyb3VuZCA9ICJoc2woMCwgMCUsIDk2JSkiKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yID0gIiM1NTUiDQogICAgICAgICAgICAgICAgICAgICAgICAgICksDQogICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yID0gIiNkZmUyZTUiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpcGVkQ29sb3IgPSAiI2Y2ZjhmYSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgIGhpZ2hsaWdodENvbG9yID0gIiNmMGY1ZjkiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBjZWxsUGFkZGluZyA9ICI4cHggMTJweCIsDQogICAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlID0gbGlzdChmb250RmFtaWx5ID0gIi1hcHBsZS1zeXN0ZW0sIEJsaW5rTWFjU3lzdGVtRm9udCwgU2Vnb2UgVUksIEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWYiKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgc2VhcmNoSW5wdXRTdHlsZSA9IGxpc3Qod2lkdGggPSAiMTAwJSIpDQogICAgICAgICAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgIGNvbHVtbnMgPSBsaXN0KA0KICAgICAgICAgICAgICAjIGdvYWxzX3dlaWdodCA9IGNvbERlZigNCiAgICAgICAgICAgICAgIyAgIG5hbWUgPSAid0dvYWwiDQogICAgICAgICAgICAgICMgKSwNCiAgICAgICAgICAgICAgYXNzaXN0c193ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3QXNzaXN0cyINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgc2hvdHNfb25fZ29hbF93ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3U09HIg0KICAgICAgICAgICAgICApLA0KICAgICAgICAgICAgICBnaXZlYXdheXNfd2VpZ2h0ID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAid0d2QSINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgc2hvdHNfYmxvY2tlZF93ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3U2hCbGsiDQogICAgICAgICAgICAgICksDQogICAgICAgICAgICAgIGJsb2Nrc193ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3QmxvY2tzIg0KICAgICAgICAgICAgICApLA0KICAgICAgICAgICAgICB0YWtlYXdheXNfd2VpZ2h0ID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAid1RrQSINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgZmFjZW9mZnNfd29uX3dlaWdodCA9IGNvbERlZigNCiAgICAgICAgICAgICAgICBuYW1lID0gIndGVyINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgZmFjZW9mZnNfbG9zdF93ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3RkwiDQogICAgICAgICAgICAgICksDQogICAgICAgICAgICAgIHBlbmFsdHlfbWludXRlc193ZWlnaHQgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJ3UGVuIg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ICAgICAgICAgICAgICAgICBhbGlnbiA9ICJjZW50ZXIiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5XaWR0aCA9IDEwMCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyQ2xhc3MgPSAiaGVhZGVyIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgc29ydE5BTGFzdCA9IFRSVUUsIGhlYWRlclN0eWxlID0gbGlzdChmb250V2VpZ2h0ID0gNzAwKQ0KICAgICAgICAgICAgICAgICAgICAgICksDQogICAgICAgICAgICAgICAgICAgICAgdGhlbWUgPSByZWFjdGFibGVUaGVtZSgNCiAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyU3R5bGUgPSBsaXN0KA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiY6aG92ZXJbYXJpYS1zb3J0XSIgPSBsaXN0KGJhY2tncm91bmQgPSAiaHNsKDAsIDAlLCA5NiUpIiksDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiJlthcmlhLXNvcnQ9J2FzY2VuZGluZyddLCAmW2FyaWEtc29ydD0nZGVzY2VuZGluZyddIiA9IGxpc3QoYmFja2dyb3VuZCA9ICJoc2woMCwgMCUsIDk2JSkiKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yID0gIiM1NTUiDQogICAgICAgICAgICAgICAgICAgICAgICAgICksDQogICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yID0gIiNkZmUyZTUiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpcGVkQ29sb3IgPSAiI2Y2ZjhmYSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgIGhpZ2hsaWdodENvbG9yID0gIiNmMGY1ZjkiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICBjZWxsUGFkZGluZyA9ICI4cHggMTJweCIsDQogICAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlID0gbGlzdChmb250RmFtaWx5ID0gIi1hcHBsZS1zeXN0ZW0sIEJsaW5rTWFjU3lzdGVtRm9udCwgU2Vnb2UgVUksIEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWYiKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgc2VhcmNoSW5wdXRTdHlsZSA9IGxpc3Qod2lkdGggPSAiMTAwJSIpDQogICAgICAgICAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgIGNvbHVtbnMgPSBsaXN0KA0KICAgICAgICAgICAgICAjIGdvYWxzX3dlaWdodCA9IGNvbERlZigNCiAgICAgICAgICAgICAgIyAgIG5hbWUgPSAid0dvYWwiDQogICAgICAgICAgICAgICMgKSwNCiAgICAgICAgICAgICAgcGxheWVyID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAiUGxheWVyIg0KICAgICAgICAgICAgICApLA0KICAgICAgICAgICAgICBnYW1lX3Njb3JlID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAiR2FtZSBTY29yZSINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgb2dzID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAib0dTIg0KICAgICAgICAgICAgICApLA0KICAgICAgICAgICAgICBkZ3MgPSBjb2xEZWYoDQogICAgICAgICAgICAgICAgbmFtZSA9ICJkR1MiDQogICAgICAgICAgICAgICksDQogICAgICAgICAgICAgIGZncyA9IGNvbERlZigNCiAgICAgICAgICAgICAgICBuYW1lID0gImZHUyINCiAgICAgICAgICAgICAgKSwNCiAgICAgICAgICAgICAgcGdzID0gY29sRGVmKA0KICAgICAgICAgICAgICAgIG5hbWUgPSAicEdTIg0KICAgICAgICAgICAgICApDQogICAgICAgICAgICApKSANCmBgYA0KDQpMZXQncyB0YWtlIExpeiBTY2hlcGVycyBzaW5jZSBzaGUgZGlkIGEgbGl0dGxlIGJpdCBvZiBldmVyeXRoaW5nIGluIHRoaXMgZ2FtZS4gICAgICAgICAg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