Learn R Programming

elo (version 3.0.2)

elo.markovchain: Compute a Markov chain model for a series of matches.

Description

Compute a Markov chain model for a series of matches.

Usage

elo.markovchain(
  formula,
  data,
  family = "binomial",
  weights,
  na.action,
  subset,
  k = NULL,
  ...,
  running = FALSE,
  skip = 0
)

Arguments

formula

A formula. See the help page for formulas for details.

data

A data.frame in which to look for objects in formula.

family

Argument passed to glm.

weights

A vector of weights. Note that these weights are used in the Markov Chain model, but not the regression.

na.action

A function which indicates what should happen when the data contain NAs.

subset

An optional vector specifying a subset of observations.

k

The probability that the winning team is better given that they won. See details.

...

Argument passed to glm.

running

Logical, denoting whether to calculate "running" projected probabilities. If true, a model is fit for group 1 on its own to predict group 2, then groups 1 and 2 to predict 3, then groups 1 through 3 to predict 4, etc. Groups are determined in formula. Omitting a group term re-runs a glm model to predict each observation (a potentially time-consuming operation!)

skip

Integer, denoting how many groups to skip before fitting the running models. This is helpful if groups are small, where glm would have trouble converging for the first few groups. The predicted values are then set to 0.5 for the skipped groups.

Details

See the vignette for details on this method. The probabilities we call 'k' purely for convenience. The differences in assigned scores (from the stationary distribution pi) are fed into a logistic regression model to predict wins or (usually) a linear model to predict margin of victory. It is also possible to adjust the regression by setting the second argument of adjust(). As in elo.glm, the intercept represents the home-field advantage. Neutral fields can be indicated using the neutral() function, which sets the intercept to 0.

Note that by assigning probabilities in the right way, this function emits the Logistic Regression Markov Chain model (LRMC).

References

Kvam, P. and Sokol, J.S. A logistic regression/Markov chain model for NCAA basketball. Naval Research Logistics. 2006. 53; 788-803.

See Also

glm, summary.elo.markovchain, score, mov, elo.model.frame

Examples

Run this code
elo.markovchain(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = tournament,
  subset = points.Home != points.Visitor, k = 0.7)

elo.markovchain(mov(points.Home, points.Visitor) ~ team.Home + team.Visitor, family = "gaussian",
  data = tournament, k = 0.7)

Run the code above in your browser using DataLab