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

feat: adding scaling to arx_forecaster #228

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

dsweber2
Copy link
Contributor

Draft of giving the user the option to include population scaling in arx_forecaster. This is something that @brookslogan, @dshemetov, @nmdefries, and I discussed on Wednesday as something that basic users are likely to want easy access to. Defaults to current behavior (i.e. scaled=FALSE).
Example call

jhu <- case_death_rate_subset %>%
  dplyr::filter(time_value >= as.Date("2021-12-01"))
out <- arx_forecaster(
  jhu %>% filter(time_value <= as.Date("2021-12-23")), "death_rate",
  c("case_rate", "death_rate"),
  args_list = arx_args_list(scaled = TRUE, scaling_df = state_census)
)

and the result:

> out$predictions %>%
+   select(-c(forecast_date, .pred_distn)) %>%
+   inner_join(jhu, by = join_by(geo_value, target_date == time_value))
+ # A tibble: 56 × 5
   geo_value   .pred target_date case_rate death_rate
   <chr>       <dbl> <date>          <dbl>      <dbl>
 1 ak        0       2021-12-30       36.4     0.0395
 2 al        0.631   2021-12-30       73.7     0.154 
 3 ar        0.546   2021-12-30       72.0     0.523 
 4 as        0.00727 2021-12-30        0       0     
 5 az        1.38    2021-12-30       39.8     0.635 
 6 ca        5.74    2021-12-30       76.0     0.140 
 7 co        1.11    2021-12-30       93.5     0.462 
 8 ct        0.506   2021-12-30      143.      0.333 
 9 dc        0       2021-12-30      295.      0.0802
10 de        0.521   2021-12-30      119.      0.449 
# ℹ 46 more rows
# ℹ Use `print(n = ...)` to see more rows

Things still to do before this could be merged:

  • document the new feature
  • provide the same behavior in arx_classifier
  • possibly write some tests

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

Successfully merging this pull request may close these issues.

None yet

1 participant