Torvaney / regista

An R package for soccer modelling
https://torvaney.github.io/regista/
GNU General Public License v3.0
85 stars 8 forks source link

predict.dixoncoles requires unnecessary home/away goals columns #21

Closed Torvaney closed 6 years ago

Torvaney commented 6 years ago

Shouldn't need hgoal and agoal specified to predict:

library(tidyverse)
library(regista)

fit <- dixoncoles(hgoal, agoal, home, away,
                  data = premier_league_2010)

premier_league_2010 %>% 
  predict(fit, newdata = .)
#> # A tibble: 380 x 2
#>    home_rate away_rate
#>        <dbl>     <dbl>
#>  1      2.40     0.873
#>  2      2.35     0.685
#>  3      2.42     0.846
#>  4      3.23     1.04 
#>  5      2.30     0.938
#>  6      1.38     1.22 
#>  7      1.85     0.910
#>  8      1.79     0.892
#>  9      1.80     1.06 
#> 10      1.36     1.07 
#> # ... with 370 more rows

premier_league_2010 %>% 
  select(-hgoal, -agoal) %>%
  predict(fit, newdata = .)
#> Error in eval_tidy(f_lhs(f1), data): object 'hgoal' not found