Featured post

Textbook: Writing for Statistics and Data Science

If you are looking for my textbook Writing for Statistics and Data Science here it is for free in the Open Educational Resource Commons. Wri...

Wednesday, 31 December 2014

GDA-PK, a cleaner powerplay skill measure for NHL hockey

In the Vancouver Canucks' latest game, a 3-1 win against at the Anaheim Ducks on December 29, a paradox happened in the first period:

At the 13:31 mark, Vancouver got a 2-minute minor penalty
At the 14:26 mark, Anaheim got a 2-minute minor penalty
At the 15:18 mark, Vancouver got another 2-minute minor penalty.
All penalties ran their full course without being converted into goals.

So, for
13:31 - 14:25, Anaheim had a 5-4 powerplay (55 seconds)
15:18 - 15:30, Anaheim had a 4-3 powerplay (13 seconds)
16:26 - 17:17, Anaheim had a 5-4 powerplay (52 seconds).

Anaheim enjoyed a total of two minutes of powerplay advantage, which makes sense because Vancouver received one more penalty. However, for the sake of measuring Vancouver's ability to kill penalties or Anaheim's ability to use them, this counts as three distinct powerplays.

To me, this seems counter-intuitive for multiple reasons.
- Anaheim somehow managed to have more powerplays than penalties given in their favour.
- Most powerplays are of two minutes in length, but one of these was only 13 seconds long.
- Had it just been Vancouver's two penalties, this period would be recorded as one long powerplay of 13:31 - 17:17. So by getting a penalty, so it looks like Anaheim got two extra powerplays by getting a penalty.
- Had it just been Vancouver's two penalties and the first ended in a goal, it would be recorded as two powerplays, which would look like Anaheim getting an extra powerplay by scoring a goal.



My general objections to the counting of powerplays, and powerplay-based metrics, PK% and PP%*, include:

- Two-player advantages, although rare, are treated the same as one-player advantages.
- Powerplays from 5-minute major penalties are treated the same as 2-minute minors, even though minor (and double-minor) penalties end when the team with the player advantage scores.
- Shorthanded goals are ignored.
- The output of the statistics, like 82% PK and 24% PP, aren't intuitive to the viewer as to what to expect. We can compare the PK% and PP% teams to say that Anaheim is very good on the powerplay, and that Vancouver is very good shorthanded relative to other teams, but it doesn't give the viewer a good idea of the chances of a powerplay goal.


A better solution already exists; GAA*, as in Goals Against Average, which is normalized by time. I propose to adapt GAA into two alternate measures.

GDA-PK: Goal difference average - penalty killing.
GDA-PP: Goal difference average - power play.

where

(GDA-PK) = (Shorthanded goals scored - Shorthanded goals against) / (minutes shorthanded) 

(GDA-PP) = (Powerplay goals scored - Powerplay goals against) / (minutes shorthanded) 

- Going through the Vancouver-Anaheim anomaly again, we would record 0 goals against Vancouver in 2 total minutes. the fact that those 120 seconds are interrupted twice doesn't factor into the computation. 

- If the powerplay had been cut short by a goal, less powerplay time and 1 goal would be recorded.

- If there had only been the two Vancouver penalties, more powerplay time would have been recorded and the two-player advantage time could be used for something else, such as GDA-2PP.

- The longer time of  five-minute major and four-minute double minor penalties are reflected fairly in GDA-PK and GDA-PP.

- Multiple goals during a major penalty do not result in an absurd measure such as a PP% of more than 100%.

- Shorthanded goals are included and simply treated as goals in the opposite direction.

The results that come out these metrics may look like this (THIS HAS NOT YET BEEN CALCULATED, PLEASE DO NOT QUOTE THESE AS ACTUAL FIGURES) :

----------------------
Vancouver Lumbermen**
- 0.103 Goals/min PK ( 2nd in NHL) 

Anaheim Mighty Mallards**
+ 0.138 Goals/min PP ( 4th in NHL)
----------------------

Numbers-keen viewers can get a sense of the average goals any given penalty will cost, and it provides the same comparative sort of ranking as PP% and PK% but with less noise from special cases.  As an added bonus, a fair comparison to even strength play can be made as well by a similar calculation.

Finally, The fact that some Powerplay intervals are cut short by a goal being scored is a non-issue. It has already been addressed (Bartholomew 1957 for the math, Mullet 1977 for the application)***.

Your thoughts? Disagreements welcome in commentary.

========================

* Definitions:
PK% is short for Penalty-Kill Percent. It is a measure of defensive ability in shorthanded situations and calculated by (Goals against when shorthanded / Number of shorthanded situations) X 100%.

PP% is short for Power Play Percent, a measure of offensive ability in player-advantaged situations, is calculated by (Goals scored when player-advantaged / Number of player-advantaged situations) X 100%

GAA, short for Goals Against Average is a metric used to measure goalies and teams' defensive abilities. It is calculated by (Goals against / Hours of play).


** The names of the teams have been changed to emphasize that these numbers are for demonstration only. A lesson to novice statisticians, numbers you throw out, however casually or verbally, have a habit of being quoted as serious analyses. I'm trying my best to avoid that while still giving an example.


*** References: 
Bartholomew, D. J. (1957), “A problem in Life Testing,” Journal of the American Statistical Association,
52, 350-355

Mullet, G. M. (1977), “Simeon Poisson and the National Hockey League,” The American Statistician,
31, 8-12

Thursday, 18 December 2014

New Kudzu Material - The Halls of Lorsem

Here is an update to Scrabble Dungeon, which I'm calling Kudzu for the time being to give it a better search niche, and to avoid future lawsuits.

Google Drive link to 2014-12-17 Version

There are only typo fixes to the material that was in the 2014-12-05, but a lot of new material has been added.

Specifically, a new six-room dungeon called "The Halls of Lorsem" and eight new Relics to draw from a random deck.

To avoid this becoming a single unwieldy document, new material will likely be given as separate modules while rule changes will follow future versions of this document.

Sunday, 14 December 2014

Examples of the Play to Donate model

It's December, so in the spirit of giving, I've been looking for ways to make better use of my phone. Specifically, uses of the Play to Donate business model, because it's motivation to continue developing the scrabble style dungeon crawler (see previous post).

There have been a few of these in the last 10 years, but they never seem to take off. In the Play Store for Android, I found three apps:

Give a Heart, which is the app port of the website of the same name. They have a simple catch the falling objects game, which occasionally rewards players with donation hearts. Donation hearts can be given to your choice of many charities, and they translate to 10 cents per heart.

Give a Heart has almost no activity, which is probably good because anyone with skill could produce more donations than the ad revenue being produced. The mobile port of the game is buggy, and playing it is truly an act of charity. I do like that skill increases the donation potential, although this is a tricky thing to pull off from a designer standpoint. A pity really, because a better game and a more active or aggressive revenue stream and this could go somewhere.

ALS Ice Bucket Challenge, by Fortee Too Games, is a good foil. This is another catch falling object game, but it's native to mobile and runs much better. In this game, skill is rewarded by unlocking videos of the ice bucket challenge. There are full screen ads between every three games, which is about one every 90 seconds.

42% of the ad revenue goes to ALS research, but there's no way to see your personal contributions. Also, being good at the game means seeing fewer ads, so if you're playing out of charity, it is tempting to throw games intentionally. Also, the game is only amusing for ten minutes, shorter when you realize the video rewards are YouTube links.

Swagbucks, is a paid to surf system with an option to donate earnings. It's mostly on the traditional web, but it has a mobile search widget that functions similarly.

Swagbucks has games, licensed of commissioned from third parties, but the large majority of player earnings come from other activities like watching videos and searching the web.

In short, for existing systems, either the games are ineffective or the donation potential is. Disappointing really.

Friday, 5 December 2014

Scrabble Dungeon - The Cavern

Scrabble Dungeon is a crossword style game for 1 player. Turn-for-turn, it plays similarly to Scrabble, and has RPG elements like resource management and a modular presentation like Dungeons and Dragons.

This is a rough draft of the first module, in tabletop format.


Scrabble Dungeon - The Cavern

I have ambitions to make several of these modules, because I think there's a lot of fun mechanics and maps that can be slotted into the game without much difficulty. I'd also like to explore the possibility of making it an Android app in the future, potentially with ads and under a play-to-donate model.

If any of you could have a look at this, especially reading the rulebook (2 main pages + 1 appendix page), I'd appreciate it greatly. Is the rulebook simple enough? Does it leave unanswered questions? Does it need a turn by turn example? Making it easy to digest is my current concern.

Please get back to me in the comments or at jackd@sfu.ca

Monday, 17 November 2014

First look at the statistical thesaurus


Part of my work at the Institute for the Study of Teaching and Learning in the Disciplines, or ISLTD for short, is to develop a handbook for statistical design and analysis.

The clients of the ISTLD are Simon Fraser University faculty across all disciplines that are looking to incorporate new teaching ideas and methods into their courses. This handbook is intended for faculty and grad student research assistants with little statistical background. As such, the emphasis is on simplicity rather than accuracy.

One wall I've run into in making this document as accessible as possible is terminology. Different fields use different terms for the same statistical ideas and methods. There's also a lot of shorthand that's used, like "correlation" for "Pearson correlation coefficient".

Why is spatial autocorrelation referred to as 'kriging'? Why is spatial covariance described in terms of the 'sill' and the 'nugget'? Because those are the terms that the miners and geologists came up with when they developed it to predict mineral abundance in areas.

Why are explanatory variables still called 'independent variables' in the social sciences even though it causes other mathematical ambiguities? Because they're trying not to imply a causal relationship by using terms like 'explain' and 'response'.

For the sake of general audience readability field specific language will be kept to a minimum, and shortenings will be used whenever a default option is established, as it is with correlation. However, the alternate terms and shortenings will be included and explained in a statistical thesaurus to be included with the handbook.

Here are three pages from the rough draft of that thesaurus. Since such a thesaurus, to my knowledge, has not been published before, I would very much appreciate your input on its readability, or what terms should be included.


https://docs.google.com/document/d/15IWtH9a_bpfhu2cvvtBOCL6FCCaH7zyPwDDsLEXz7d4/edit?usp=sharing

Thanks for reading!
- Jack

Tuesday, 4 November 2014

Sabremetrics, A.K.A. applied metagaming.

In baseball, sabremetrics started a push for batters to hold off for more and better pitches. By 2011 or 2012, strikeout rates were higher than they were in a century, probably in part of the reduced hitting but also due to pitchers throwing more pitches, knowing they would be swung at less often. How long until batters adapt and capitalize on the higher quality pitches they are receiving to increase hit rates and home runs instead of waiting for many pitches?

This is an example of perfect imbalance, as explained in this video by Extra Credits.  Players of strategic games that involve a lot of pre game decisions often refer to these decisions and the information leading to them as "the meta game". In MOBA games like League of Legends or fighting games like Smash Bros. or Soul Caliber this amounts to selecting one's avatar character and the bonuses they will bring into the start of a match. In collectible and living card games like Magic: The Gathering and Android: Netrunner the meta game is one's deck building process and the popular types of decks among one's opponents.

The pre game decisions, the meta game, in sports include who to hire and how to train. In sports where game-to-game fatigue is a factor, such as hockey with goalies or baseball with pitchers, the meta also involves choosing who will start the game, and how well that matches against the opposing goalie or pitcher.

The general idea of metagaming is to make choices that counter the likely choices of opponents. Against a learning opponent, this requires constant adaptation.

Consider fashion, where to win is to receive  attention, admiration as a consumer and sales as a designer. Fashion is played by wearing/creating an outfit that stands out from that of the existing crowd.

Consider the red queen hypothesis, a biological principle whereby a species succeeds by apadting to its prey predators and competitors. Specifically, the red queen hypothesis is that since all species are doing this, the best a species can hope for is to keep up in evolution, never get ahead.

Sabremetrics got so big as a statistical toolset not simply because it was interesting or novel, but because it was actionable. It provided information that could be converted in decisions, instead of just being elegant or produce a pretty graph.

If hitting in baseball is due for a comeback, might it make sense to load up your farm team with sluggers and curveball pitchers now? Do you reduce your emphasis on stolen bases in anticipation of fewer pitches per at bat?

Would a change from walks and strikeouts to hitting favour franchises that traditionally rely on high scores like Texas, or ones that rely on many small hits like Kansas City?

As always, comments welcome, including those stating I'm wrong about everything.

Monday, 3 November 2014

Teach the Controversy

What if we started including short (500 words, 2 pages double spaced) essay assignments into the stats curriculum?  Students could choose from various controversial topics in stats. They could be referred to a small amount of literature, such as a paper or a couple of book chapters on their chosen issue.
 
Essay questions could include:
- Take a side, or compare Bayesian vs Frequentist methods.
- Take a side, or compare parametric vs non parametric methods.
- ... or simulations vs real data.
- How important is parsimony vs accuracy?
- How valuable is null hypothesis testing, what does it mask?
- Should pvalues be the gold standard?
- How feasible are causality studies?
- Is multiple testing a valid remedy?
- Is imputation a valid remedy?
- Are the flexibility of ultra-complex methods like neural networks worth the fact that they can't be explained or described reasonably?
- Why do we use the mean as the basis for everything instead of the median?
 
In service courses, the essays could be more about social issues that statistics illuminate rather than the methodology itself.
 
- Discuss what multiple regression reveals about the wage gap between sexes. 
- Discuss publication bias and how asymmetric tests like funnel plots can expose it.
- Discuss the pros and cons of bar graphs and pie graphs.
- Consider [attached infographic]. Describe the author is trying to convey. Describe, as best you can from this graphic, what is really going on? How could the graphic more clearly convey this?
 
There are a lot of articles in chance magazine that a social studies ugrad could add their own perspective to while learning to incorporate statistical arguments into their own essays. Math background students benefit from the writing practice and wider perspective, and writing students will have an opportunity to use their strengths in an otherwise intimidating class.
 
The essay prompts above can be answered at multiple levels of depth, allowing them to be slotted into different courses. Finally, this gives the instructor license to remove other written questions from the remaining assignments, which can offset the change in marking load. The necessary material for writing would come at the cost of either some methods or some mathematical depth, but given the challenges in modern statistics, being able to consider questions like those above is worth that cost.