Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Sunday, January 19, 2020

A challenging task - part II

Part I

So, after a few delays and long contemplation, the page regarding coaches' and teams' treatment by the NHL's Situation Room in Toronto has been added to the website under the section 'League' and the title 'Toronto Love'.

We provide statistics, per season, on how many initiated challenges a particular team or a coach won or lost, and also whether that side "won" or "lost" a challenge by the opponent, or in a league-initiated challenge or a video review - merely by the outcome being in favor or against the given team. Not all situations could've been accounted for but we estimate more than 99% were.

A narrative has been supported. The San Jose Sharks' treatment this season has been unprecedented and bad. Both by the difference in bad-good outcomes and by margin from the nearest team.



The page will be expanded in the future, providing span data as well as graph cards.

Tuesday, December 10, 2019

A challenging task

While the page "Coaches - Challenges" has been present on my website for a long while, it was always bothering me with a variety of inaccuracies, as well as the inability to properly incorporate another event, when the Situation Room interferes with the game: the Video Review. Therefore I put myself to a task of comprehensive accounting of all Coach Challenges and Video Reviews dating back to 2015.

The main information about challenges and reviews comes from the Play By Play sheets. In many cases the flow is straightforward:

  • There's a CHL event with the type of challenge and the challenging side
  • There's the outcome in form of the timeout event by the challenging side
Unfortunately, the data is not very consistent and in many cases, lacking. Sometimes there's no CHL event, but instead a STOP event with a CHLG string. Sometimes the timeout is not there. Sometimes the challenge is attributed to 'League' - something that should only happen in the last minutes of the third period or in the overtimes. Sometimes there are two challenges, and one is missing. And sometimes even the wrong team is attributed to the challenge. While overall the NHL data is pretty steady, the challenge is the worst - probably because it involves a lot of human-contemplated input. And a lot of Video Reviews just go AWOL from that event sheet.

Fortunately, from about mid-2015 season, NHL publishes the "Situation Room Blog" - a rubrique on its site that is very scrape-able and moderately structured. Thus I was able to pick all the Situation Room proceedings since around January 2015 and parse them into a structure similar to the challenges from the PBP sheets. Then I was able to cross-compare the lists per game. That allowed me to correct quite a few challenges as well as add more challenges and video reviews.

The total tally includes:
  • 885 Coach challenges from CHL events
  • 264 Coach challenges from STOP events
  • 30 Coach challenges from Situation Room blog
  • 56 Video Reviews from CHL events
  • 937 Video Reviews from STOP events
  • 216 Video Reviews from Situation Room blog
Altogether 2388 events.

I consider the League Challenges equivalent to Video Reviews.

In the next blog post I'll show how they are breaking down by outcomes for each team and in other ways. I plan to add a page of challenges and reviews in the Team section of my website.

Tuesday, February 27, 2018

Website - A Page A Day, Part VII - Buchholz and Sonneborn-Berger

Prologue
Part I
Part II
Part III
Part IV
Part V
Part VI (I need to make a table of contents entry)

This might be the best possible timing for revisiting this page.

We are now past the first section of the website, 'League', and onto the second and probably the richest one - 'Teams'. It opens with Buchholz and Sonneborn-Berger coefficients for the teams.

And why is the timing the best? Because I am going to give a lightning talk about this at the VANHAC 2018!

Actually I already blogged about these two before, so now only a brief recap will follow with a couple of examples:

1. The Buchholz coefficient

The Buchholz coefficient is simply the sum of the points of your opponents.

B = Σn=1N Pn

So, if you played five games, and your opponents currently have 5, 3, 8, 6 and 6 points, your Buchholz value will be 28. Please note, that the current number of points is always used, not the number of points at the moment of meeting. The outcome of the game does not matter (for that one see the Sonneborn-Berger).

 the Buchholz coefficient can clearly show, who has had the stronger opposition up until a certain moment.

Then, if we look at the remainder of the schedule for each team, and for every game we add the opponent's points we get an excellent remaining schedule strength estimator.

Wait... there's a caveat.

Unlike in a chess tournament, where every round occurs for everyone at the same time, and barring very rare circumstances, every participant played an equal amount of games at any point of the tournament, there may be a significant difference in the number of games played by different teams, so summing the opponents up will not work very well. And these opponents also played a different number of games, so their total amount of points is not a very good indicator.

Fortunately, it's not a big deal. Instead of totals, let's operate with per-game numbers. So the NHL Buchholz Coefficient for a team after N games becomes:

B = (Σn=1N PPGn)/N. 

Same applies for the remaining schedule strength, where the per-game numbers of the remaining opposition are summed an averaged.

So, if the team played three games against opponents who currently are:
A) 6 points in 4 games, B) 3 points in 3 games, C) 2 point in 5 games, then the team's Buchholz value would be (6/4 + 3/3 + 2/5) / 3 = 2.9/3 ~ 0.967pts.

Here are the Mar 12th 2017 Buchholz coefficients and remaining schedule strengths for the entire 30 times (and note how the Blues stand out with plenty of matchups vs Colorado and Arizona remaining).

+-----------------------+-----------+-------+-------+
| Team Name             | PPG       | Buch  | RStr  |
+-----------------------+-----------+-------+-------+
| Washington Capitals   | 1.4179105 | 1.119 | 1.133 |
| Pittsburgh Penguins   | 1.4029851 | 1.117 | 1.127 |
| Minnesota Wild        | 1.3939394 | 1.090 | 1.070 |
| Columbus Blue Jackets | 1.3731343 | 1.125 | 1.132 |
| Chicago Blackhawks    | 1.3283582 | 1.088 | 1.096 |
| San Jose Sharks       | 1.2985075 | 1.106 | 1.106 |
| New York Rangers      | 1.2941176 | 1.120 | 1.184 |
| Ottawa Senators       | 1.2537313 | 1.105 | 1.169 |
| Montreal Canadiens    | 1.2352941 | 1.122 | 1.097 |
| Edmonton Oilers       | 1.1791044 | 1.121 | 1.040 |
| Anaheim Ducks         | 1.1764706 | 1.102 | 1.150 |
| Calgary Flames        | 1.1764706 | 1.099 | 1.140 |
| Boston Bruins         | 1.1470588 | 1.115 | 1.151 |
| Toronto Maple Leafs   | 1.1343284 | 1.114 | 1.150 |
| Nashville Predators   | 1.1323529 | 1.105 | 1.116 |
| St. Louis Blues       | 1.1194030 | 1.144 | 0.943 |
| New York Islanders    | 1.1194030 | 1.142 | 1.103 |
| Tampa Bay Lightning   | 1.0895522 | 1.121 | 1.134 |
| Los Angeles Kings     | 1.0746269 | 1.118 | 1.104 |
| Philadelphia Flyers   | 1.0447761 | 1.122 | 1.179 |
| Florida Panthers      | 1.0298507 | 1.118 | 1.175 |
| Carolina Hurricanes   | 1.0000000 | 1.138 | 1.136 |
| Buffalo Sabres        | 0.9855072 | 1.127 | 1.158 |
| Winnipeg Jets         | 0.9565217 | 1.110 | 1.143 |
| Vancouver Canucks     | 0.9558824 | 1.115 | 1.152 |
| Dallas Stars          | 0.9552239 | 1.119 | 1.100 |
| Detroit Red Wings     | 0.9545455 | 1.151 | 1.059 |
| New Jersey Devils     | 0.9117647 | 1.148 | 1.132 |
| Arizona Coyotes       | 0.8358209 | 1.133 | 1.098 |
| Colorado Avalanche    | 0.6119403 | 1.128 | 1.164 |
+-----------------------+-----------+-------+-------+

2. The Sonneborn-Berger coefficient.
This stranger beast is a metric extensively used for tie-breaks in chess-round robins and as an auxiliary tie-break tool to the Buchholz coefficient in non-round robin. Let's start with the definition.

$$SB = Σ↙{n=1}↖N f(R_n,P_n)$$

where Rn is the result against the n-th opponent, and Pn is the opponent's points score.
The function  f(Rn, Pn) in the NHL is defined as:

f(Win, Pn) = Pn/N
f(OW, Pn)  = 2*Pn/(N*3)
f(OL, Pn)  = Pn/(N*3)
f(L, Pn)   = 0
where N is the number of games by that opponent

to account for the overtime point.

Then, we can calculate the minimal possible SBmin value for a team with the given schedule so far this season, by assigning Wins to be against the weakest teams played, and the OW/OL against the weakest remainder until the sum of W, OW and OL points add up to the number of points the team currently has.

Similarly we shall calculate the maximal possible SBmax value by assigning Wins to be against the strongest teams played, and the OW/OL against the strongest of the remainder, assuming OT wins are about 1/4 of the whole.

Then the closer the actual SB is to the SBmin or SBmax we may be able to say whether the team is successful more against the bottom feeders, the top guns, or whether it achieves its points from the whole spectrum available.

Here is the table describing how teams had their SB positioned between SBmin and SBmax. on 03/12/2017, multiplied back by the number of games of each team for better visibility:

TeamPointsSBminSBoptSBSBmax
Pittsburgh Penguins1.4044.2846.4846.2453.06
Washington Capitals1.4044.7046.7447.7752.89
Minnesota Wild1.3742.2544.3646.6350.66
Columbus Blue Jackets1.3743.1045.3646.4452.15
Chicago Blackhawks1.3441.6143.9043.7950.80
San Jose Sharks1.3140.6842.9744.1649.84
New York Rangers1.3041.2543.6745.5550.92
Ottawa Senators1.2537.8440.0741.7946.78
Montreal Canadiens1.2539.3741.7441.0548.87
Anaheim Ducks1.1936.8639.4340.1247.15
Calgary Flames1.1835.9738.4938.2046.05
Edmonton Oilers1.1635.8638.3237.4345.70
Boston Bruins1.1534.7337.2337.7444.72
Nashville Predators1.1333.2836.1438.0444.72
Toronto Maple Leafs1.1334.6436.9935.6644.02
St. Louis Blues1.1234.6937.1438.5244.50
New York Islanders1.1234.3636.9437.9444.71
Tampa Bay Lightning1.0932.6234.9835.4142.06
Los Angeles Kings1.0732.1034.6633.5642.34
Philadelphia Flyers1.0431.2633.5632.0140.48
Florida Panthers1.0330.8933.1230.9539.82
Carolina Hurricanes1.0029.4331.7832.4138.85
Buffalo Sabres0.9930.0932.4933.4339.68
Winnipeg Jets0.9627.5530.3531.4838.75
Vancouver Canucks0.9628.4830.9129.0238.21
Dallas Stars0.9428.0530.6231.1638.34
Detroit Red Wings0.9429.1231.1230.0237.13
New Jersey Devils0.9127.7830.1528.6337.27
Arizona Coyotes0.8425.1327.2425.8633.56
Colorado Avalanche0.6117.9019.7419.9825.25

Once again, we use Point Per Game values because the teams and their opponents have a different number of games played at most of the moments within a season.

We would dare to make one more step forward and claim that the team that performs closer to SBmax seem to have a coach problem (notable differences highlighted in green in the table above). The roster is there to compete against the best, but the points aren't trickling in at a pace goo

Sunday, February 25, 2018

Website A Page - A Day, Part VI - Warm Welcome


Prologue
Part I
Part II
Part III
Part IV
Part V

With nothing else to do for about half an hour, why not to resume the series?

Have you wondered if it is your team, or your goalie, who always has the first career goal scored against them? Now you can check if your feeling is right. On the page 'Warm Welcome' of the League section on the website we present a look at the first goals scored against different teams and goalies.

With the two left items in the top menu you can select the span over which you want to see the statistics. Want one season only? Select the same season for the start and for the end. Then you can toggle the view by the team or the goalie the first goal is scored against.

For example, for the 2016/17 season, team view:

# Team Goals Allowed
1 Dallas Stars 7
2 Carolina Hurricanes 7
3 New Jersey Devils 7
4 Tampa Bay Lightning 6
5 Ottawa Senators 6
6 Detroit Red Wings 5
7 Pittsburgh Penguins 5
8 New York Rangers 5
9 San Jose Sharks 5
10 Vancouver Canucks 5
11 Colorado Avalanche 5
12 Nashville Predators 4
13 Boston Bruins 4
14 Buffalo Sabres 4
15 Winnipeg Jets 4
16 Arizona Coyotes 3
17 Columbus Blue Jackets 3
18 Edmonton Oilers 3
19 Montreal Canadiens 3
20 Anaheim Ducks 3
21 St. Louis Blues 3
22 Los Angeles Kings 2
23 Washington Capitals 2
24 Calgary Flames 2
25 Minnesota Wild 2
26 New York Islanders 2
27 Toronto Maple Leafs 2
28 Chicago Blackhawks 2
29 Florida Panthers 2
30 Philadelphia Flyers 0

Take a look. You might be surprised. Or not.

Monday, February 5, 2018

The Website - A Page A Day, Part V - Rink Repairs

Prologue
Part I
Part II
Part III
Part IV

Well, the pace didn't last long, but we're back with Part V - Rink Repair Statistics

Probably, this is the least hockey related page of the website, but hey, we can do it, and it's actually pretty easy, so why not?

The STOP events as listed in the Play-By-Play HTML summaries since the 2002/03 season on the NHL.com website contain the reason(s) for the stop. While most of them are game-based, such as ICING or OFFSIDE, one of the more rare ones caught our eye: RINK REPAIR. We decided to collect these stops and rank NHL home teams as well as NHL arenas by the amount of rink repairs that happened. We filter out the occasional venues, such as outdoor stadiums for NHL special events or the foreign arenas for the European showdown games.

Since we already parse practically all events from the Play-By-Play summaries (or PL), and classify them by types, we already have a collection of STOP events. And we also detect and catalog the reasons for the stoppages, so it is an easy Mongo query to extract all rink repairs incurred. We then aggregate them by locations and teams, and create SQL tables for easy quick display of the data.

And so we were able to assemble a nice set of tables displaying the level of maintenance in the rinks around the league. Here's a look at the 2016/17 season:

Arena Repairs
BARCLAYS CENTER 8
XCEL ENERGY CENTER 3
CANADIAN TIRE CENTRE 2
VERIZON CENTER 2
PEPSI CENTER 2
FIRST NIAGARA CENTER 2
NATIONWIDE ARENA 2
CENTRE BELL 2
WELLS FARGO CENTER 1
SCOTTRADE CENTER 1
ROGERS ARENA 1
REXALL PLACE 1
PRUDENTIAL CENTER 1
CONSOL ENERGY CENTER 1
BB&T CENTER 1
JOE LOUIS ARENA 1
HONDA CENTER 1
So the claims that the Islanders' current home has the worst ice has been substantial. For the last three years, actually, Barclays Center ranks among highest. Naturally, the old arenas like Canadian Tire Centre or Rexall Palace also seemed to get a lot of rink repairs during the games.
You can switch the year of the display or the mode between 'By Team' and 'By Arena'.
As with all the displayed tables on our site, there are links below it to see it in a pristine form, the direct link to the page for the selected season, and buttons to share it on Twitter and Facebook.
Once again, it doesn't seem like a highly meaningful piece of work, but we consider it fun, and it took about quarter an hour to implement altogether.
TODO:
  • Aggregate show by a period rather than a single season
  • Include arena ages (requires manual input of construction years)

Friday, January 26, 2018

The Website - A Page A Day, Part IV - West vs. East

Prologue
Part I
Part II
Part III

And now we're putting two in a row with West vs. East.

PART IV

This page shows the results of games between Eastern and Western Conference teams. The data is available from the year 1993, when Western and Eastern Conference were formed, from the Boxscore files.

Shown from left to right:
  • Regular West wins
  • OT/SO West wins
  • Ties(up to year 2005)
  • OT/SO East wins
  • Regular East wins
  • Stanley Cup Winning Conference
A total tally is available as well. As of the date of this post the standings are:
WEST 2802 Reg. W - 595 OTW - 444 T - 541 Reg. W - 2570 Reg. W EAST
West holds a formidable lead which eroded a bit in the 2015/16 and 2016/17 seasons. Before that the last time East won the count was back in 1998/99! The 2009/10 was the most lopsided season with the final score of 155-115 in West's favor.
West won 14 times, East - 6. Once, in 2011/12 there was a tie with 134 wins apiece.

The Stanley Cup winners are divided more evenly, however, with West holding the edge 13-10.

There is no data for seasons 1994/95, 2004/05 and 2012/13 because of full or or partial season lockout. Also, the win-loss count from the Finals are not included.

WE NEED YOUR HELP!
If you are an experienced Webmaster, especially with Javascript and CSS we would greatly appreciate the potential tidy-up and enrichment you could provide to these graphs. Your work will be credited for future reference! Write to us, or get in touch with us on Twitter. Thanks!

Possible future additions:
  • Season aggregation
  • More compact design
  • Your ideas are welcome!

Thursday, January 25, 2018

The Website - A Page A Day, Part III - NHL's Yearly Tendencies

Prologue
Part I
Part II

Despite all the delays we move on to League's Yearly Tendencies.

PART III

This view shows stacked bars of various event counts per season in the NHL.All the stats are presented per game, since the amount of games played varied every season.

For the first time we encounter the stat selection menu, on top of the graphs. On this page it features the following options:

  • Category of the stats
  • Stage of the games (Regular or Playoff)

Available stats are:
  • Shots
    • Goals (available since 1987, from Boxscore reports)
    • Shots on Goal (available since 1987, from Boxscore reports)
    • Misses (available since 2005, from PBP reports)
    • Blocks (avaliable since 2005, from PBP reports)
  • Icings (available since 2002, from PBP reports)
  • Margin of victory (available since 1987, from Boxscore reports)
  • Penalties
    • Minor
    • Major
    • Fighting
    • Misconduct
    • Match Penalty
  • Goals per Game
The stats are available for regular season, playoffs and both stages combined.

The PBP reports from the NHL dating before 2005 are wildly inconsistent, thus we didn't use them for MISSES and BLOCKS.

We are using the wonderful d3js library for producing these graphs.

WE NEED YOUR HELP!
If you are an experienced Webmaster, especially with Javascript and CSS we would greatly appreciate the potential tidy-up and enrichment you could provide to these graphs. Your work will be credited for future reference! Write to us, or get in touch with us on Twitter. Thanks!

Possible future additions:
  • PowerPlay success
  • Minor penalty breakdown
  • Aggregations and overlays
  • Mouse graph manipulations
  • Your ideas are welcome!

Tuesday, January 9, 2018

The Website - A Page A Day - Prologue

Hello, hockey world, from Mr. Van Winkle...

This prolonged silence was caused by a lot of factors, led, naturally, by REAL LIFE™. But I also made a fundamental mistake in the infrastructure setup, and so I had to roll out a hastily patched setup when the season was starting; I then went back and worked on this infrastructure fix, the work which continued over three months and is now complete! Unfortunately, all this work will not be visible to the visitor, with possible exception of a slightly faster page loading - all the changes belong to the back end.

But now, once again, with REAL LIFE™ limitations I am able to work on improving the website look, speed and features. I am being somewhat torn apart since I also need to hone the models I'm using, but I decided the models can wait with half of the hockey season gone by now. In addition I'll try to put an extra effort to promote the site and made it more visible on the Web.

One of the things I was not able to complete is to release my code as the open source. This has also been put into a bottom drawer. However, I still welcome cooperation very much and will gladly share the code with people who would want to contribute to the project. The areas I could really use some help are:
  • JavaScript/HTML/CSS
  • MongoDB query and database optimization
  • SEO optimization
So if you feel like helping - drop me a mail.

Also I will begin a series "Website - A Page A Day", where I plan to describe each and every statistical page on the site because I have a feeling I haven't been clear enough with the explanations until now; moreover it will help me discover errors and inconsistencies that probably crawled through.

So, stay tuned, here in this blog, on the website, and on Twitter!