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.

Thursday, February 9, 2017

On goalposts statistics

Why does the cat lick his balls?
Because it can.

Recently I saw a request on a stats of goal posts / crossbars hit per game. While I do have that statistic per player, I haven't one for games, so - since I can - why shouldn't I produce one?

About half an hour of Perl-ing created the following summary:

Irons altogether, top:
AWAY    HOME                P C T
OTT  vs BUF  on 2011/12/31: 8 0 8
VAN  vs FLA  on 2010/02/11: 7 0 7
WPG  vs FLA  on 2009/12/05: 6 1 7
TOR  vs BUF  on 2007/10/15: 6 1 7
TBL  vs FLA  on 2006/04/01: 6 1 7
PHI  vs PIT  on 2006/03/12: 7 0 7
COL  vs NYI  on 2005/12/17: 7 0 7
NSH  vs DAL  on 2016/03/29: 4 2 6
PIT  vs NSH  on 2014/03/04: 5 1 6
NYI  vs TBL  on 2014/01/16: 3 3 6
DAL  vs VAN  on 2013/02/15: 5 1 6
STL  vs CAR  on 2012/03/15: 5 1 6
WPG  vs MTL  on 2011/01/02: 6 0 6
OTT  vs VAN  on 2011/02/07: 6 0 6
MTL  vs CAR  on 2011/11/23: 6 0 6
LAK  vs DAL  on 2010/03/12: 4 2 6
NJD  vs TBL  on 2009/10/08: 6 0 6
LAK  vs DAL  on 2009/10/19: 5 1 6
DAL  vs CBJ  on 2009/01/31: 5 1 6
COL  vs CHI  on 2009/11/11: 6 0 6
PIT  vs WPG  on 2008/01/30: 5 1 6
NYR  vs NJD  on 2008/04/09: 4 2 6
STL  vs ARI  on 2007/01/15: 5 1 6

followed by 109 games with 5 irons hit.

Crossbars, top:
AWAY    HOME                P C T
CGY  vs CBJ  on 2008/11/08: 1 4 5
NYR  vs FLA  on 2007/11/23: 0 4 4
PHI  vs FLA  on 2006/12/27: 1 4 5
BUF  vs DAL  on 2017/01/26: 1 3 4
EDM  vs DAL  on 2016/01/21: 2 3 5
TOR  vs STL  on 2015/01/17: 1 3 4
CHI  vs ANA  on 2015/05/19: 1 3 4
BOS  vs VAN  on 2015/02/13: 1 3 4
NYI  vs TBL  on 2014/01/16: 3 3 6
CHI  vs ANA  on 2008/01/04: 2 3 5
CAR  vs FLA  on 2007/11/12: 1 3 4

followed by 50 games with 2 crossbars hit.

The data is extracted from the PBP files of NHL.com, from the year 2005 on.

However I consider this a one-time effort and will not add this to the website itself.

Wednesday, February 1, 2017

On Streaks and Breaks

3 articles in two days... What's gotten into me.

So after remembering the Botwinnik's quote, and after publishing the stats how the teams actually play after different breaks, a new idea came to me - check whether the teams on streaks are affected positively or negatively by breaks.

For the sake of the analysis, I assumed the following:
  • A break is a period of three days at least between games.
  • A streak is a sequence of at least three wins in a row, or at least seven points in four games.
So we check for the last thirty years (as far as NHL.com would let us in) if the streaking team was able to keep the streak alive, or whether the streak was broken:

SEASON ALIVE BROKEN
1987/1988 5 11
1988/1989 12 7
1989/1990 8 14
1990/1991 13 11
1991/1992 17 13
1992/1993 20 16
1993/1994 19 20
1994/1995 2 7
1995/1996 15 11
1996/1997 15 11
1997/1998 12 20
1998/1999 12 9
1999/2000 18 12
2000/2001 21 11
2001/2002 17 6
2002/2003 13 10
2003/2004 12 14
2005/2006 31 15
2006/2007 16 16
2007/2008 23 24
2008/2009 15 20
2009/2010 14 17
2010/2011 19 11
2011/2012 22 11
2012/2013 6 3
2013/2014 15 15
2014/2015 16 16
2015/2016 16 14
2016/2017 8 11
TOTAL 432 376

Actually, it looks like the streaks weren't affected by the break either way. 53.4% of the times the streak continued, 46.6% of the time it went dead. There is a very large discrepancy between the seasons, although I'd attribute it to lesser parity between the teams overall in these years. For the last 5 years, the probability for the streak to stay alive has been 50.8% (61 cases of extended streaks out of 120).

Now, what would change, if we define a break a little bit longer, by a single day:

SEASON ALIVE BROKEN
1987/1988
2
2
1988/1989
4
1
1989/1990
3
1
1990/1991
4
4
1991/1992
7
8
1992/1993
8
2
1993/1994
7
7
1994/1995
1
1
1995/1996
6
7
1996/1997
6
2
1997/1998
5
5
1998/1999
6
2
1999/2000
9
3
2000/2001
7
4
2001/2002
6
4
2002/2003
5
1
2003/2004
3
6
2005/2006
16
4
2006/2007
8
5
2007/2008
10
6
2008/2009
8
8
2009/2010
6
6
2010/2011
9
3
2011/2012
8
4
2012/2013
2
1
2013/2014
3
9
2014/2015
5
9
2015/2016
7
6
2016/2017
3
8
TOTAL
174
129

The changes are rather interesting. Now, overall, the chances of streak to continue are up to 57.4%, and only in 42.6% of the cases it came to a stop. But in the last five years - since the last lockout - and with the schedule changes so that there are at least two games between every team (increasing travel), the ratio drops from 50.8% to the humble 37.7% (20 out of 53!)

Extending the breaks to five days provides too little data to draw any conclusions.

So I am inclined to agree with Dr. Botwinnik, that extended breaks of more than three days throw teams off their pace and should be reduced to minimum. Three days are borderline alright.

A rule change suggestion

There's no irreplaceable people.
I.V. Stalin

Rushing this one up, because this idea already came to my mind before, but I forgot about it. The age is taking its toll.

Anyways. Everyone is talking these days about rule changes. I've already expressed a few thoughts on the scoring systems, but I am not original there. Now, however, I want to make a suggestion I haven't seen mentioned yet.

Allow soccer (baseball, too)-like substitutions in hockey. Allow the coaches to replace players in the original lineup at the start of the game with one of the "healthy scratches", as submitted in the roster sheet, like the one Peter DeBoer recently messed up in the game against Edmonton.

The substitution goes ONE-WAY. That means that the player that was substituted cannot return to the game. The substitutions may occur:

  • During the intermissions
  • During the commercial breaks
  • During a time-out
First and foremost this will allow teams to handle early injuries much better. Your D-man got injured at the 7:04 mark of the 1st period? Around 10:00 there will be a commercial break, you can substitute him with one of the scratches!

Second, it may allow coaches to send stronger messages to players they deem slacking. Rather than shorten the roster by benching that guy, you can send an eager healthy scratch in. Of course, then the "slacking" player is benched for the whole remainder of the game.

Third (oh, I did military service, so I have a natural obsession of providing three reasons for each thing), it may give the coaches some extra flexibility if a designated roster player gets slightly injured in the warm-ups. Then a scratch takes his place as usual, but if the original player is fixed by the 1st intermission, he can substitute the starting scratch.

The substitutes will have to come from the "scratch" list with the exception of the emergency goaltending contracts.

Oh, and I am sure the NHL website will make a mess out of it in their game reports.

Tuesday, January 31, 2017

On A Hockey Website

Yesterday our town was honoring signor Trombetti Giovancarlo, 
who after thirty years of work, alone, with no help, 
recorded the opera "Aida" by Giuseppe Verdi.

Gianni Rodari, "A Musical Story".

Just to not let the month of January slip away without another post, I got sentimental and decided to tell a small story about how my website came to life.

There was a void. A lot of time people on hockey boards would wonder if specific statistics of players and teams were available, and they wouldn't, although the raw data seemed to be there. Then, there was the fantasy hockey world, with its pizzazz, and asking for a predictive tool, - and again, the raw data seemed to be there.

Now, I am a sysadmin by trade, with occasional forays into software development, and since I've been doing Perl for all of my career, I got a few exposures to the Web development process and to databases. I've got a college degree in Engineering, so that gave me some idea about statistics.

So I got a look at the publicly available NHL reports, but was unsure of how to use them. I tried some standard database approach, but it wasn't working.

The turning point came when I attended a lecture on MongoDB. That one turned out to be perfect, with the loosely compiled NHL stats documents, just spill them into the Mongo database. Then extract data from them and summarize them into tables. Store the tables in an SQL database for quick serving on the website. And along came more luck - a lecture on the Mojolicious Perl Web framework which equipped me with an easy solution for how to run a website.

Thus, I was able to actually implement what I had in mind. First came the spider part, to crawl and collect the data available on NHL.com. Fortunately, I was able to scrape everything before the website's design changed drastically, and the box scores prior to 2002 stopped being available. I got everything from the 1987/88 season on.

Then, I started writing the parsers,.. and had to take a step back. There was quite a lot of inconsistent and missing reports. Therefore I had to a) add a thorough testing of every report I scraped to ensure it came together, b) look for complementing sources for whatever data was missing. So before I got done with the parsers, I had a large testing framework, and also visited all corners of the hockey-related websites to get the missing or conflicting data resolved, even the online archives of newspapers such as USA Today. Some of the downloaded reports had to be edited manually. Then, NHL.com landed another blow, dropping draft pick information from their player info pages. Luckily, the German version of the website still had it, so I began to scrape the German NHL website too.

I was able to produce the unusual statistics tables relatively quickly and easily. However I decided that the website will not open without the prediction models I had in mind. Being a retired chess arbiter and a big chess enthusiast I decided to try to apply the Chess Elo rating model to the performances of hockey teams and players. Whether it really works, or not, I don't know yet. I guess by the end of the season I can make a judgement on that.

In October 2016 I opened my website by using a free design I found somewhere online. Unfortunately, I quickly realized it was not a good fit with the contents the site was serving, so I sighed, breathed some air, opened w3schools.com in my browser, and created my own design. And a CMS too. At least I am happy with the way the site looks now, and even more happier that when someone asks a question - on Twitter, Reddit or hockey forums - whether it's possible to measure a specific metric, I am able to answer, 'Already done! Welcome to my website!'

At the end I'm a software developer, a web designer, a DBA, a sysadmin, a statistician and an SEO amateur. Oh, and a journalist too, since I'm writing a blog.

Monday, January 23, 2017

On Intangibles (a small addendum)

One "intangible" being tossed around is "motivation" of the players. Which brings memories of an episode I was witness to.

In 2003/04, in the Israeli Top Tier Chess League (which is indeed no slouch) our club managed to assemble an outstanding team, featuring, among others, a former Champion of Russia and a former Champion of Europe. I was part of the management team, and orchestrated bringing the first of the two, who also happened to be my childhood friend back in Leningrad, Soviet Union.

And so, in round III we were to face our main rival for the title, and the club's GM (also a pedestrian chess player) gathered the team and carried out a pronounced motivational speech, how we have to beat the team we're facing, and so on, and so on.

We lost 1½-4½ without winning a single game and lost any chance for the championship we could have.

Sunday, January 22, 2017

On Intangibles. Carpe Jugulum.


Often the general managers, the coaches and the players talk about "intangible values". Sometimes it's about the "locker room contributions". Sometimes it's about "passion". In my opinion, these two are actually negligible and in certain cases even harmful. I remember such references, especially the latter one, made about Israeli soccer players, and that usually meant that the player doesn't have a lot of talent to go along, but contributes a lot of passion into the game. While a passionate play can indeed ignite the play and carry the team along, more often it indicated dumb physical low-talent execution that actually harmed the team.

However, there is one intangible that I take my hat off in front. It's the one that I always admired, and myself did not have enough in my chess career. It's the ability to go for the throat of the opposition at even momentary display of weakness by it, or as Terry Pratchett put it one of its books, 'Carpe Jugulum1'.

So what is it, in my understanding? It is the situation when your opponent puts itself into an inferior position in a volatile situation (for example, in a close score), such as by a penalty, or by an icing at the end of a long shift, or by allowing an odd-man rush, and you are able to capitalize on it, yanking any remains the carpet of security from under the feet of the opposition. And then, you continue to hammer the blows on the opposition until it collapses completely. Some also call it the 'killer instinct'. This blog (and this article too) sins with abundance of examples from chess, so let me plant one from tennis... Before the match between Lleyton Hewitt and Taylor Dent at the New York Open, 2005, the latter one complained: 'He displays a poor sportsmanship: taking joy in double errors at the opponent services as well as in unforced errors.' 'I don't care what Dent thinks about it', parried Hewitt, 'I always go for a win, and on the way to it many things are allowed.'

Machiavelli advised the rulers and the politicians, 'Don't be kind'. Winston Churchill also knew something about achieving the goals when he was recommending: 'If you want to get to your goal, don't be delicate or kind. Be rough. Hit the target immediately. Come back and hit again. Then hit again with the strongest swing you can...'

All the chess champions had it, the extremes going to Alexander Alekhine, Robert J. Fischer and Garry Kasparov. Many wonderful players that never got the title complained that they couldn't commit themselves to going for the throat of the opponent time after time.

These qualities were elevated to perfection by the two best teams of the first half of 2010s, by the Los Angeles Kings and the Chicago Blackhawks that split between themselves five cups out of six from 2010 to 2015. Even when both teams seem to be struggling and wobbling, they seemed to be able to instill some kind of uncertainty into their opponents - and certainty into the spectators that these teams are going to be able to make a fist out of themselves that is going to hammer their opponents once they display any kind, and minimal level of weakness. That capability was championed by their leaders, Anze Kopitar, Drew Doughty and Jeff Carter for the Kings, and Jonathan Toews, Patrick Kane and Duncan Keith for the Hawks. When the playoffs series between the Blackhawks and their opponents were tied 3-3, Chicago has always been the favorite to win the game 7 because of their Carpe Jugulum reputation. The Kings gained even more notoriety, first by burying their sword to the hilt into each and every opponent in 2012 en route from the #8 seed to their first Stanley Cup, and then from the reverse sweep they managed against the Sharks that started their 2014 Cup run - which included two more comings from behind, 2-3 and 1-3. And even in 2016, down 1-3 to the Sharks in the first round of the playoffs somehow fans around the league were not ready to commit to the Sharks as the favorites to win the series, because the Kings were a hair away from the Sharks' throat in game 4, from 0-3 to 2-3 in the 3rd period, and then in game 5, they indeed were able to erase the 0-3 deficit into a 3-3 tie.

Well, that tie didn't hold, the Sharks broke the stranglehold and got a boost that carried them all the way to their own first even Stanley Cup Finals, and that outcome got the Kings' reputation as the Carpe Jugulum team damaged to a degree. So did the Blackhawks' one, losing their game 7 to a team that - along with the Sharks and, for instance, the Washington Capitals - had a reputation of a somewhat nonplussed one - the St. Louis Blues.

It would be entertaining to see whether the Carpe Jugulum landscape changes this year in the league, and whether the teams who were able to overcome their "benign" reputation will be able to go all the way to the Cup Finals - through their opponents' throats.

Chess Grandmaster Gennady Sosonko wrote, 'A real professional, having thought about the situation on the board, acts most decisively. He knows, that during the game, there should be no place either for doubt, nor for compassion, because a thought which is not converted into action, isn't worth much, and an action that does not come from a thought isn't worth anything at all.'

And it's important to remember, Carpe Jugulum is a necessary key to success in a competitive environment only. Albert Einstein used to say that chess "are foreign to me due to their suppression of intellect and the spirit of rivalry."

1Carpe Jugulum (lat.) - seize the throat.