as.matrix converts an Elo object into a matrix of running Elos. These are the Elos at the time of grouping, but before any regression takes place.

# S3 method for elo.run
as.matrix(x, ...)

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

# S3 method for elo.run
as.data.frame(x, ...)

final.elos(x, ...)

# S3 method for elo.run
final.elos(x, ...)

# S3 method for elo.run.regressed
final.elos(x, regressed = FALSE, ...)

Arguments

x

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

...

Other arguments (Not in use at this time).

regressed

Logical, denoting whether to use the post-regressed (TRUE) or pre-regressed (FALSE) final Elos. Note that TRUE only makes sense when the final Elos were regressed one last time (i.e., if the last element of the regress()) vector yields TRUE).

Value

A matrix, a data.frame, or a named vector.

Details

as.data.frame converts the "elos" component of an object from elo.run into a data.frame.

final.elos is a generic function to extract the last Elo per team.

See also

Examples

e <- elo.run(score(points.Home, points.Visitor) ~ team.Home + team.Visitor + group(week),
             data = tournament, k = 20)
head(as.matrix(e))
#>      Athletic Armadillos Blundering Baboons Cunning Cats Defense-less Dogs
#> [1,]            1510.000           1490.000     1490.000          1510.000
#> [2,]            1499.425           1500.575     1500.575          1499.425
#> [3,]            1489.425           1490.575     1510.575          1509.425
#> [4,]            1499.458           1480.542     1520.542          1499.458
#> [5,]            1489.458           1470.542     1520.542          1489.458
#> [6,]            1490.033           1461.971     1509.681          1480.033
#>      Elegant Emus Fabulous Frogs Gallivanting Gorillas Helpless Hyenas
#> [1,]     1490.000       1510.000              1510.000        1490.000
#> [2,]     1500.575       1499.425              1499.425        1500.575
#> [3,]     1490.575       1489.425              1509.425        1510.575
#> [4,]     1480.542       1499.458              1499.458        1520.542
#> [5,]     1490.542       1509.458              1509.458        1520.542
#> [6,]     1501.403       1518.883              1508.883        1529.113
str(as.data.frame(e))
#> 'data.frame':	56 obs. of  8 variables:
#>  $ team.A  : Factor w/ 8 levels "Athletic Armadillos",..: 2 4 6 8 3 4 7 8 4 3 ...
#>  $ team.B  : Factor w/ 8 levels "Athletic Armadillos",..: 1 3 5 7 1 2 5 6 1 2 ...
#>  $ p.A     : num  0.5 0.5 0.5 0.5 0.471 ...
#>  $ wins.A  : num  0 1 1 0 1 0 0 1 1 1 ...
#>  $ update.A: num  -10 10 10 -10 10.6 ...
#>  $ update.B: num  10 -10 -10 10 -10.6 ...
#>  $ elo.A   : num  1490 1510 1510 1490 1501 ...
#>  $ elo.B   : num  1510 1490 1490 1510 1499 ...
final.elos(e)
#>   Athletic Armadillos    Blundering Baboons          Cunning Cats 
#>              1564.318              1453.079              1518.019 
#>     Defense-less Dogs          Elegant Emus        Fabulous Frogs 
#>              1421.394              1509.851              1532.986 
#> Gallivanting Gorillas       Helpless Hyenas 
#>              1513.944              1486.411