elo (version 2.0.0)

elo.run: elo.run

Description

Calculate Elos for a series of matches.

Usage

elo.run(formula, data, na.action, subset, k = NULL,
  initial.elos = NULL, ...)

# S3 method for elo.run print(x, ...)

# S3 method for elo.run.regressed print(x, ...)

Arguments

formula

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

data

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

na.action

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

subset

An optional vector specifying a subset of observations.

k

A constant k-value (or a vector, where appropriate).

initial.elos

An optional named vector containing initial Elo ratings for all teams in formula.

...

Other arguments (not used at this time).

x

An object of class "elo.run" or class "elo.run.regressed".

Value

An object of class "elo.run" or class "elo.run.regressed".

See Also

score, elo.run.helperselo.run helpers, elo.calc, elo.update, elo.prob, elo.model.frame.

Examples

Run this code
# NOT RUN {
data(tournament)
elo.run(score(points.Home, points.Visitor) ~ team.Home + team.Visitor,
        data = tournament, k = 20)

# Create non-constant 'k'
elo.run(score(points.Home, points.Visitor) ~ team.Home + team.Visitor +
        k(20*log(abs(points.Home - points.Visitor) + 1)), data = tournament)

# Adjust Elo for, e.g., home-field advantage
elo.run(score(points.Home, points.Visitor) ~ adjust(team.Home, 30) + team.Visitor,
        data = tournament, k = 20)

tournament$home.field <- 30
elo.run(score(points.Home, points.Visitor) ~ adjust(team.Home, home.field) + team.Visitor,
        data = tournament, k = 20)

# Regress the Elos back toward 1500 at the end of the half-season
elo.run(score(points.Home, points.Visitor) ~ adjust(team.Home, 30) +
        team.Visitor + regress(half, 1500, 0.2), data = tournament, k = 20)

# }

Run the code above in your browser using DataLab