Compute a (usually logistic) regression based on win percentage for a series of matches.

elo.winpct(
formula,
data,
family = "binomial",
weights,
na.action,
subset,
...,
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 are used in calculating wins and losses but not in the regression. A function which indicates what should happen when the data contain NAs. An optional vector specifying a subset of observations. 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

Win percentages are first calculated. Anything passed to adjust() in formula is also put in the data.frame. A glm model is then run to predict wins or margin of victory.

With this setup, the intercept represents the home-field advantage. Neutral fields can be indicated using the neutral() function, which sets the intercept to 0.

## Examples

elo.winpct(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = tournament,
subset = points.Home != points.Visitor)
#>
#> An object of class 'elo.winpct', containing information on 8 teams and 51 matches.
#>

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