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
)

## Arguments

formula A formula. See the help page for formulas for details. A data.frame in which to look for objects in formula. Arguments passed to glm. A vector of weights. Note that these weights are used in the Markov Chain model, but not the regression. A function which indicates what should happen when the data contain NAs. An optional vector specifying a subset of observations. The probability that the winning team is better given that they won. See details. Arguments passed to glm. 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!) 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).

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

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

## Examples

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