Showing posts with label game scores. Show all posts
Showing posts with label game scores. Show all posts

Wednesday, August 16, 2017

A revision of HTML reports from the NHL website.

So, while revising and revisiting the data files, I did an extra scan of the HTML reports available on NHL.com .

The HTML reports are extracted through the following URL pattern: 

sprintf('http://www.nhl.com/scores/htmlreports/%d%d/%s%02d%04d.HTM', $season, $season+1, $type, $stage, $game_id) 

where $season is the start year of the season, $type is the type of the report, $stage is 2 for regular, 3 for playoff, and $game_id is the NHL game id for the season.

Below are the results for the problematic games, with the reports that are beyond salvage marked accordingly:

Season Stg GameId ES GS PL RO
1999 Reg 0029 M M N N
1999 Reg 0045 I I N N
1999 Reg 0050 I I N N
1999 Reg 0058 R R N N
1999 Reg 0071 I I N N
1999 Reg 0072 I I N N
1999 Reg 0081 I I N N
1999 Reg 0109 I I N N
1999 Reg 0130 I I N N
1999 Reg 0323 R R N N
1999 Reg 0619 I I N N
1999 Reg 0689 I I N N
1999 Reg 0690 B I N N
1999 Reg 0836 I I N N
1999 Reg 1034 I I N N
1999 P/O 0325 I I N N
2000 Reg 0029 R R N N
2000 Reg 0038 R R N N
2000 Reg 0039 I I N N
2000 Reg 0041 R R N N
2000 Reg 0042 R R N N
2000 Reg 0043 R R N N
2000 Reg 0044 R R N N
2000 Reg 0045 I I N N
2000 Reg 0049 R R N N
2000 Reg 0067 R R N N
2000 Reg 0072 I I N N
2000 Reg 0073 I I N N
2000 Reg 0077 I I N N
2000 Reg 0080 R R N N
2000 Reg 0083 R R N N
2000 Reg 0085 I I N N
2000 Reg 0095 R R N N
2000 Reg 0102 I I N N
2000 Reg 0112 R R N N
2000 Reg 0186 I I N N
2000 Reg 0187 I I N N
2000 Reg 0189 I I N N
2000 Reg 0920 R R N N
2000 Reg 0921 I I N N
2000 Reg 0924 R R N N
2000 Reg 0925 R R N N
2000 Reg 0926 R R N N
2000 Reg 0928 I I N N
2000 Reg 0983 B V N N
2000 Reg 1166 I I N N
2003 Reg 0191 V I V N
2003 Reg 1205 I I I N
2003 P/O 0134 V V B N
2005 Reg 0298 R V V N
2005 Reg 0458 B V V N
2005 Reg 0677 V V V B
2005 Reg 0679 V V V B
2005 Reg 0681 V V V B
2007 Reg 1178 I I B I
2008 Reg 0259 I I B I
2008 Reg 0409 I I B I
2008 Reg 1077 I I B I
2009 Reg 0081 I I B I
2009 Reg 0827 V I V V
2009 Reg 0836 V I V V
2009 Reg 0857 I I V V
2009 Reg 0863 I I V V
2009 Reg 0874 I I V I
2009 Reg 0885 I V V I
2010 Reg 0429 I I V V
2011 Reg 0259 I I V V
Legend:
I - incomplete (not through the end of the game)
B - broken (doesn't pass HTML parser)
M - misplaced (belongs to a different game that doesn't have a file associated with it)
R - replica (copy of a file from another game
N - not available (file not available on NHL.com)
V - file is good.

Monday, May 1, 2017

On carrying Momentum...

Frequently, the importance of carrying momentum over an intermission can be heard being talked about. I thought it were possible to measure this harmony with algebra, so I tried to do that. I choose to analyze a very specific question:

If the regulation of a game ends in a tie, other than 0-0, how frequently would the team that tied the game with the last regulation goal win in overtime. 

We would define the team that tied the game as the one having the momentum. We would define the other team as the one trying to show resilience. For answering the question, we analyzed the outcome of games of seasons 2007/08-2016/17 (including the ongoing playoffs). We discard the games that end in a shootout, because their outcome depend truly more on the skill of the shooting players/goaltenders rather than the whatever momentum might've been accrued.

The results of the analysis are displayed in the table below, per season, per the time frame during which the last tying goal was scored: in the last two, five, or ten minutes, in the last period, or in one of the first two. The numbers show the percentage of wins by the team having the momentum and the number of games falling into that specific segment. Also we display a separate column and a separate row for playoffs game, although a finer granularity is not really possible because of the sample size.

Season   2        5        10       20       1st/2nd  total     totalPO
2007     54.2/24  57.9/19  52.9/34  53.8/13  52.6/38  53.9/128  31.2/16
2008     43.5/23  48.1/27  45.2/31  53.8/13  40.0/40  44.8/134  25.0/16
2009     42.9/28  56.5/23  72.7/22  64.7/17  53.7/41  56.5/131  58.8/17
2010     48.6/37  54.2/24  47.1/34  40.7/27  56.8/44  50.0/166  59.1/22
2011     50.0/24  45.8/24  43.5/23  72.0/25  47.7/44  51.4/140  37.5/24
2012     62.5/16  33.3/15  50.0/22  50.0/14  57.9/19  51.2/86   53.8/26
2013     58.1/43  43.5/23  34.6/26  45.5/22  44.1/34  46.6/148  70.8/24
2014     51.7/29  65.2/23  55.3/38  46.7/15  60.5/43  56.8/148  57.9/19
2015     60.0/40  46.7/30  44.4/36  45.8/24  39.6/48  47.2/178  52.6/19
2016     43.6/39  50.0/28  60.5/38  48.1/27  61.8/68  54.5/200  63.2/19
totalPO  61.4/44  46.7/30  55.8/43  68.4/19  40.9/66  52.0/202 52.0/202
total   51.5/303 50.4/236 50.7/304 51.8/197 51.8/419 51.3/1459 52.0/202

We see that there is no specific "momentum" nor "resilience" capability overall, there is practically no indication on how the OT would end based on which team scored the last GTG. The only two moderate exceptions with decent sample sizes are the second and the sixth columns of the penultimate row. The GTG-scoring team is 27-17 (61.4%) in case it scored the tying goal in the last two minutes, however if the GTG was scored before the last period, as it happened in 66 games, the momentum would obviously not carry over two or more intermissions, and the tying team is 27-39 (40.9%) in these games.

Here is how it looks on a graph:
We can see all lines wobbling slightly above the 50 mark. Insufficiently above. Even if we observe the extra 1.3% chance overall (2.0% in playoffs) - wouldn't it be more related to the home/away advantage? I haven't looked at this aspect yet. Maybe another time.

The Real Life[TM] took a bit of a toll on this blog... But we resume, with resilience and hoping to generate momentum!

Thursday, March 30, 2017

On the NHL Scoring System - Part III

Part I
Part II


Once again, driven by idea that if you want to encourage goal scoring, you need to reward the goal scoring in standings directly, not indirectly through winning. Then, based on the idea of a fellow hockey fan and blogger, a new suggestion was born in my mind.

Not so long ago I was involved in another discussion on the subject on Twitter, where an interesting alternative, 2-1-0-0 was described. The idea is that you still get two points for a win in regulation, just one point for a win in OT, but nothing if you lose, and, the key, both teams get nothing if the game is tied at the end of regulation (shootouts are abolished). This is a very sharp idea, but for me something felt very wrong, and then it crystallized:

It's not fair to reward a hard fought 5-5 tie with zero points, just like a lazy-skated 1-1. We still want to encourage goal scoring, and the simple 2-1-0-0 just unbalances the game. And so it dawned on me. We should reward goals with extra standings points!

The formula that first came to mind, and which seemed fair: give each goal a 0.1 point in the standings, while the win-scoring system shall be 2-1-0-0. If you or your database have an aversion against decimals, assign 20 points for a win, 10 points for OT loss, and 1 extra point for each goal scored. This will encourage goal scoring in any situation, and for both sides, including the games that go into garbage time pretty quickly. So, a 7-2 win will give the winner 2.7 points, and the loser 0.2 points. A 2-0 win will give the winner 2.2 points, the loser 0. A 4-3 OT win will give the winner 1.4 points, the loser 0.3 points. A 5-5 OT tie will give each side 0.5 points.

Wait, there's a caveat.

Imagine a situation where a team needs just 0.1 point to pass another one in the standings for the playoff spot. They are playing an opponent whose number of points in the standings does not have any effect on them. In such a situation, the team would play without a goaltender at all, because they don't care how much they lose, they just need that goal. Now, this is not really hockey, so to prevent this kind of play a restriction needs to be introduced:

Any goal scored without a goaltender on the ice, when not on a delayed penalty, and when trailing by more than two goals shall not yield any standings points.

Here is an example what the today's standings would look like under the suggested system:

Team                           W  OW T  L  GF  GA  P
Boston Bruins                  34 04 04 34 216 201 93.6
Montreal Canadiens             31 09 05 31 205 186 91.5
Ottawa Senators                32 04 08 31 191 191 87.1
--------------------------------------------------------
Washington Capitals            41 08 07 20 246 165 114.6
Columbus Blue Jackets          38 09 04 24 233 170 108.3
Pittsburgh Penguins            37 06 08 25 256 211 105.6
--------------------------------------------------------
New York Rangers               38 05 06 28 242 203 105.2
Toronto Maple Leafs            29 06 09 31 229 213 86.9
--------------------------------------------------------
New York Islanders             28 05 06 36 217 224 82.7
Tampa Bay Lightning            27 06 07 35 206 207 80.6
Carolina Hurricanes            28 04 07 36 198 208 79.8
Buffalo Sabres                 24 06 08 39 191 215 73.1
Philadelphia Flyers            22 07 11 36 193 218 70.3
Florida Panthers               21 07 11 37 192 210 68.2
New Jersey Devils              18 06 06 46 171 221 59.1
Detroit Red Wings              16 07 08 45 181 224 57.1
--------------------------------------------------------
Chicago Blackhawks             36 09 05 27 230 197 104.0
Minnesota Wild                 37 04 05 30 241 193 102.1
St. Louis Blues                35 06 02 33 213 200 97.3
--------------------------------------------------------
San Jose Sharks                35 06 03 32 204 185 96.4
Anaheim Ducks                  37 02 06 31 200 183 96.0
Edmonton Oilers                33 05 09 29 221 191 93.1
--------------------------------------------------------
Nashville Predators            33 04 06 33 224 206 92.4
Calgary Flames                 30 09 06 32 208 206 89.8
--------------------------------------------------------
Winnipeg Jets                  29 03 04 41 226 243 83.6
Dallas Stars                   27 04 02 43 207 240 78.7
Los Angeles Kings              23 11 06 36 183 185 75.3
Vancouver Canucks              19 07 06 44 169 221 61.9
Arizona Coyotes                17 04 08 48 176 245 55.6
Colorado Avalanche             14 06 01 55 150 257 49.0

Naturally, they would not be the same standings if the system were indeed implemented, but why not to take a look. And once again, try it in the AHL first, it won't hurt anyone.

Friday, February 10, 2017

On Leads Changes and Swings

Wild thing, you make my heart sing
You make everything groovy, wild thing

Also inspired by Twitter, and because I can, I decided to gather statistics on games with
  • most lead changes*
  • most lead swings**
Here, for the 2016/17 season:
By most lead swings:
AWAY    HOME   Date        Sco LC LS
CHI  vs DAL  on 2017/02/04: 5-3 7 3
CBJ  vs OTT  on 2017/01/22: 7-6 11 3
PHI  vs STL  on 2016/12/28: 3-6 7 3
MTL  vs PIT  on 2016/12/31: 3-4 7 3
CHI  vs NYI  on 2016/12/15: 5-4 7 3
ARI  vs PHI  on 2016/10/27: 5-4 9 3

with 60 games at 2 lead swings. Dallas leads the way with 8 games with at least two swings, and Carolina, Chicago, NY Islanders and Winnpeg follow with 7 each.

By most lead changes:


AWAY    HOME   Date        Sco LC LS
CBJ  vs OTT  on 2017/01/22: 7-6 11 3
TOR  vs WSH  on 2017/01/03: 5-6  9 2
TOR  vs NYI  on 2017/02/06: 5-6  9 2
NYI  vs DET  on 2017/02/03: 4-5  9 1
CHI  vs COL  on 2017/01/17: 6-4  9 2
CAR  vs NYI  on 2017/02/04: 5-4  9 2
CHI  vs STL  on 2016/12/17: 6-4  9 1
BUF  vs OTT  on 2016/11/29: 5-4  9 1
ARI  vs PHI  on 2016/10/27: 5-4  9 3

with 31 game with at least 7 lead changes. Here we've got Carolina, Chicago and NY Islanders at the lead with at least 6 games with 7 or more lead changes.

And what do we get historically?

The wildest games, regular season, by lead swings:
AWAY    HOME   Date         Sco LC LS
PHI  vs BOS  on 2011/01/13: 5-7  11 5
COL  vs CGY  on 1991/02/23: 8-10 11 5
ARI  vs CGY  on 1991/01/15: 5-7  11 5
PHI  vs COL  on 1988/11/19: 5-6  11 5

with 30 games at 4 lead swings.

The wildest games, regular season, by lead changes:
AWAY    HOME   Date        Sco LC LS
DET  vs SJS  on 2005/11/26: 7-6 13 4
MTL  vs COL  on 2002/12/06: 6-7 13 2
COL  vs SJS  on 1997/04/04: 6-7 13 2
ARI  vs PHI  on 1990/01/25: 6-8 13 1
TOR  vs PIT  on 1989/10/25: 8-6 13 3
COL  vs WSH  on 1997/11/18: 6-6 12 3
PIT  vs NJD  on 1993/04/14: 6-6 12 1
BUF  vs CAR  on 1991/12/07: 6-6 12 4
CAR  vs TOR  on 1990/02/14: 6-6 12 2
VAN  vs TOR  on 1988/01/04: 7-7 12 3

with 65 games at 11 lead changes (even numbers can only occur in the ties era).

The wildest games, playoffs, by lead swings:
AWAY    HOME   Date        Sco LC LS
STL  vs DAL  on 1999/05/08: 4-5 9 4
MTL  vs COL  on 1993/04/26: 5-4 9 4
EDM  vs LAK  on 1992/04/20: 5-8 9 4

with 33 games at 3 lead swings.

The wildest games, playoffs, by lead changes:
AWAY    HOME   Date        Sco LC LS
BUF  vs OTT  on 2006/05/05: 7-6 13 2
PHI  vs CHI  on 2010/05/29: 5-6 11 3
COL  vs SJS  on 2010/04/16: 5-6 11 1
PHI  vs WSH  on 1989/04/11: 8-5 11 3

with 42 games at 9 lead changes (only odd numbers can occur)

The data is presented since the year 1987 - the earliest boxscores from the NHL.com
Now this one is going to make it into the website, I just haven't decided in which form.

*   Lead swing is defined as when a team takes the lead after the other team had it. 
** Lead change is defined as when a team loses the lead, even if only temporarily to a tied score.