We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Below, the .pred column should be the same (it is), but the residuals should be different.
.pred
library(epipredict) library(purrr) library(dplyr) library(tidyr) jhu <- case_death_rate_subset %>% filter(time_value >= "2021-11-01", geo_value %in% c("pa", "ca", "ny")) f7 <- flatline_forecaster(jhu, "death_rate", flatline_args_list(ahead = 7)) f14 <- flatline_forecaster(jhu, "death_rate", flatline_args_list(ahead = 14)) f7$predictions %>% mutate(q = nested_quantiles(.pred_distn)) %>% unnest(q) %>% pivot_wider(names_from = tau, values_from = q) %>% select(geo_value:.pred, target_date, `0.05`, `0.95`) #> # A tibble: 3 × 6 #> geo_value time_value .pred target_date `0.05` `0.95` #> <chr> <date> <dbl> <date> <dbl> <dbl> #> 1 ca 2021-12-31 0.142 2022-01-07 0 0.392 #> 2 ny 2021-12-31 0.422 2022-01-07 0.172 0.672 #> 3 pa 2021-12-31 0.732 2022-01-07 0.482 0.982 f14$predictions %>% mutate(q = nested_quantiles(.pred_distn)) %>% unnest(q) %>% pivot_wider(names_from = tau, values_from = q) %>% select(geo_value:.pred, target_date, `0.05`, `0.95`) #> # A tibble: 3 × 6 #> geo_value time_value .pred target_date `0.05` `0.95` #> <chr> <date> <dbl> <date> <dbl> <dbl> #> 1 ca 2021-12-31 0.142 2022-01-14 0 0.392 #> 2 ny 2021-12-31 0.422 2022-01-14 0.172 0.672 #> 3 pa 2021-12-31 0.732 2022-01-14 0.482 0.982
Created on 2023-06-09 with reprex v2.0.2
Further tests suggest it is happening deep in the tidymodels processing of the workflow. It can't be replicated by calling flatline() directly.
flatline()
jhu1 <- jhu %>% mutate(ld7 = lead(death_rate, 7), ld14 = lead(death_rate, 14)) f7a <- flatline(ld7 ~ geo_value + death_rate, jhu1) f14a <- flatline(ld14 ~ geo_value + death_rate, jhu1) quantile(residuals(f7a)$.resid, probs = c(0.05, 0.95), na.rm = TRUE) #> 5% 95% #> -0.6987016 0.5442913 quantile(residuals(f14a)$.resid, probs = c(0.05, 0.95), na.rm = TRUE) #> 5% 95% #> -0.5408296 0.7069717
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Below, the
.pred
column should be the same (it is), but the residuals should be different.Created on 2023-06-09 with reprex v2.0.2
Further tests suggest it is happening deep in the tidymodels processing of the workflow. It can't be replicated by calling
flatline()
directly.Created on 2023-06-09 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: