Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings after fit #23

Closed
OMalytics opened this issue Sep 17, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@OMalytics
Copy link

commented Sep 17, 2018

Hi Ben,

I was wondering if those warnings should raise any concerns ?

library(regista)
library(tidyverse)
library(lubridate)

ligue1_1819 <- read_csv("http://www.football-data.co.uk/mmz4281/1819/F1.csv") %>%
  select(Date, HomeTeam, AwayTeam, FTHG, FTAG) %>%
  mutate(days_ago = as.numeric(today() - dmy(Date)),
         weights = discount_exponential(days_ago, .006),
         HomeTeam = as.factor(HomeTeam),
         AwayTeam = as.factor(AwayTeam))

fit <- dixoncoles(FTHG, FTAG, HomeTeam, AwayTeam, weights = weights, data = ligue1_1819)
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced
#> Warning in log(.tau(hg, ag, home_rates, away_rates, rho)): NaNs produced

Created on 2018-09-17 by the reprex package (v0.2.0).

@Torvaney

This comment has been minimized.

Copy link
Owner

commented Sep 17, 2018

Hi,

Yeah, this is not ideal. These warnings occur because the rho parameter is not adequately constrained during fitting, so sometimes throws invalid values. This isn't a concern in terms of the final fitted parameters, since the model will converge to a valid estimate for rho, but it is annoying.

It's on my radar as part of issue #1 - trying to find a better optimisation method than optim. Not sure exactly what that better method actually is, though...

Might be a good idea to put in a check or suppress the warnings somewhere in the meantime.

@Torvaney Torvaney added the dixoncoles label Sep 17, 2018

@Torvaney

This comment has been minimized.

Copy link
Owner

commented Sep 17, 2018

Also fwiw, worth looking at regista::factor_teams. For e.g.

ligue1_1819 <- read_csv("http://www.football-data.co.uk/mmz4281/1819/F1.csv") %>%
  select(Date, HomeTeam, AwayTeam, FTHG, FTAG) %>%
  mutate(days_ago = as.numeric(today() - dmy(Date)),
         weights = discount_exponential(days_ago, .006)) %>%
  factor_teams(HomeTeam, AwayTeam)

@Torvaney Torvaney closed this in 41e0721 Nov 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.