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

Bugs in modeltools::quantgen_forecaster #474

Open
kjytay opened this issue Mar 3, 2021 · 0 comments
Open

Bugs in modeltools::quantgen_forecaster #474

kjytay opened this issue Mar 3, 2021 · 0 comments
Assignees

Comments

@kjytay
Copy link
Contributor

kjytay commented Mar 3, 2021

I found some bugs when trying to run modeltools::quantgen_forecaster(). First issue I'm raising here, so not sure if better to put them together or to separate.

  1. df must be a list, if not line 152 (call to covidcast::aggregate_signals()) will fail. This is a problem if df is the returned object from covidcast::covidcast_signals() where only one signal was retrieved. In that case, the returned object from covidcast_signals() is not a list.

There are a few ways to fix this. Checking if df is a list and if not, make it so is probably the best solution.

Reproducible example:

df <- covidcast::covidcast_signal(data_source = "usa-facts", 
                                  signal = "confirmed_7dav_incidence_prop",
                                  start_day = "2020-08-01", 
                                  end_day = "2020-08-15")

modeltools::quantgen_forecaster(
  df,
  forecast_date = "2020-08-16", 
  signals = tibble::tibble(
    data_source = c("usa-facts"),
    signal = c("confirmed_7dav_incidence_prop")
  ), 
  incidence_period = "day",
  ahead = 0,
  n = 15,
  verbose = TRUE, 
  lambda = 0)

#Error in covidcast::aggregate_signals(df, dt = dt, format = "wide") : 
#  If `x` is a `covidcast_signal` data frame, then `dt` must be a vector.
  1. The code below results in an error:
# Same df as in Bug 1
df <- covidcast::covidcast_signal(data_source = "usa-facts", 
                                  signal = "confirmed_7dav_incidence_prop",
                                  start_day = "2020-08-01", 
                                  end_day = "2020-08-15")

# Same call as in Bug 1 except for `df` argument
modeltools::quantgen_forecaster(
  list(df),
  forecast_date = "2020-08-16", 
  signals = tibble::tibble(
    data_source = c("usa-facts"),
    signal = c("confirmed_7dav_incidence_prop")
  ), 
  incidence_period = "day",
  ahead = 0,
  n = 15,
  verbose = TRUE, 
  lambda = 0)

# ahead = 0Error in apply(x, 2, mean) : dim(X) must have a positive length

This error goes away when I specify lags = c(0, 3), or even lags = 1. But when I include these lags options, the function call never terminates and I have to restart RStudio.

  1. The geo_type argument is not used anywhere in the function and should probably be removed.
@huisaddison huisaddison self-assigned this Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants