Learn R Programming

gamlr (version 1.11-2)

hockey: NHL hockey data

Description

Every NHL goal from fall 2002 through the 2013 cup finals.

Arguments

Value

  • goalInfo about each goal scored.
  • oniceMatrix with entries for who was on the ice for each goal: +1 for a home team player, -1 for an away team player, zero otherwise.
  • configSpecial teams info. For example, S5v4 is a 5 on 4 powerplay, +1 if it is for the home-team and -1 for the away team.
  • playerPlayer info: names, most common position, and plus-minus.

Details

The data comprise of information about play configuration and the players on ice (including goalies) for every goal from 2002-03 to 2012-13 NHL seasons. Collected using A. C. Thomas's nlhscrapr package. See the Chicago hockey analytics project at github.com/mataddy/hockey.

References

Gramacy, Jensen, and Taddy (2013): "Estimating Player Contribution in Hockey with Regularized Logistic Regression." http://arxiv.org/abs/1209.5026.

See Also

gamlr

Examples

Run this code
data(hockey)
x <- cBind(config,onice)
y <- as.numeric(goal$whoscored=="HOME")

## fit a lambda (gamma=0) model
plot(fit <- gamlr(x=x, y=y, family="binomial",  
      free=1:ncol(config), standardize=FALSE, 
      thresh=1e-8))

## BIC selected player coefficients
B <- coef(fit, s=which.min(BIC(fit)))[colnames(onice),] 
length(B <- B[B!=0])
## print nonzero player effects on who-scored log odds
round(B[order(-B)],3)

## predict the last goal of the 2013 playoffs (this time use AIC)
goal[fit$n,]
predict(fit,x[fit$n,,drop=FALSE],type="response",k=2)

Run the code above in your browser using DataLab