`R/elo.markovchain.R`

`elo.markovchain.Rd`

Compute a Markov chain model for a series of matches.

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

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

data | A |

family | Arguments passed to |

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. |

... | Arguments passed to |

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 |

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. |

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).

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

elo.markovchain(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = tournament, subset = points.Home != points.Visitor, k = 0.7) #> #> An object of class 'elo.markovchain', containing information on 8 teams and 51 matches. #> elo.markovchain(mov(points.Home, points.Visitor) ~ team.Home + team.Visitor, family = "gaussian", data = tournament, k = 0.7) #> #> An object of class 'elo.markovchain', containing information on 8 teams and 56 matches. #>