by Alex Elfering
Last Updated October 18, 2018 17:19 PM

I am using the elo package in R to calculate college football scores over the course of several decades. But I am having trouble understanding the regression function in the package:

This is the example given in the package documentation:

```
tournament$elo.Visitor <- 1500
elo.run(score(points.Home, points.Visitor) ~ team.Home + elo.Visitor +
regress(half, 1500, 0.2),
data = tournament, k = 20)
```

*"Giving a logical vector identifies these matches after which to regress back to the mean. Giving any other kind of vector regresses after the appropriate groupings (see, e.g., duplicated(..., fromLast = TRUE)). The other two arguments determine what Elo to regress to (to =), and by how much to regress toward that value (by =)."*

I have tried to enter "regress(half, 1500, 0.2)" on my computer but R does not recognize "half". What are they putting in there to make their regression work?

Notice that `half`

is a variable in the dataset `tournament`

:

```
library(elo)
data(tournament)
str(tournament)
> 'data.frame': 56 obs. of 7 variables:
> $ team.Home : chr "Blundering Baboons" "Defense-less Dogs" "Fabulous Frogs" "Helpless Hyenas" ...
> $ team.Visitor : chr "Athletic Armadillos" "Cunning Cats" "Elegant Emus" "Gallivanting Gorillas" ...
$ points.Home : num 14 21 15 13 22 18 20 23 25 23 ...
$ points.Visitor: num 22 18 11 15 13 20 22 10 16 18 ...
$ week : num 1 1 1 1 2 2 2 2 3 3 ...
$ half : chr "First Half of Season" "First Half of Season" "First Half of Season" "First Half of Season" ...
$ elo.Visitor : num 1500 1500 1500 1500 1500 1500 1500 1500 1500 1500 ...
tournament$elo.Visitor <- 1500
elo.run(score(points.Home, points.Visitor) ~ team.Home + elo.Visitor +
regress(half, 1500, 0.2),
data = tournament, k = 20)
An object of class 'elo.run.regressed', containing information on 8 teams and 56 matches, with 2 regressions.
```

So you just have to use (or more likely create) the relevant variable name(s) in your own dataset:

- Serverfault Help
- Superuser Help
- Ubuntu Help
- Webapps Help
- Webmasters Help
- Programmers Help
- Dba Help
- Drupal Help
- Wordpress Help
- Magento Help
- Joomla Help
- Android Help
- Apple Help
- Game Help
- Gaming Help
- Blender Help
- Ux Help
- Cooking Help
- Photo Help
- Stats Help
- Math Help
- Diy Help
- Gis Help
- Tex Help
- Meta Help
- Electronics Help
- Stackoverflow Help
- Bitcoin Help
- Ethereum Help