Skip to content

Commit 3e57aec

Browse files
committed
geo_pooled
1 parent 55ddeee commit 3e57aec

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

scripts/reports/decreasing_forecasters.Rmd

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ More quantitatively, across all geos:
141141
basic_gr <- get_growth_rates(all_forecasts, quantiles = 0.5, method = "smooth_spline")
142142
basic_gr %>% arrange(desc(growth))
143143
```
144-
The only places where the growth rate is positive are american samoa and the US overall, both of which have unusual data trends (as because it is ~0, and the US because it is unusually large).
144+
The only places where the growth rate is positive are American samoa and the US overall, both of which have unusual data trends (as because it is ~0, and the US because it is unusually large).
145145
As a histogram (each state is included 5 times, once per ahead):
146146
```{r}
147147
basic_gr %>% ggplot(aes(x = growth)) + geom_histogram(bins = 300)
@@ -161,16 +161,44 @@ And the corresponding growth rates:
161161
short_gr <- get_growth_rates(all_short_forecasts, quantiles = 0.5, method = "smooth_spline")
162162
short_gr %>% arrange(growth) %>% ggplot(aes(x = growth)) + geom_histogram(bins = 300)
163163
```
164-
So on a day-over-day basis the growth rate is mostly increasing, with some strong positive outliers and some amount of decrease.
164+
So on a day-over-day basis the growth rate is mostly increasing, with some strong positive outliers and some amount decreasing.
165165

166166
# Is it geo pooling?
167167
Let's see what happens if we restrict ourselves to training each geo separately.
168168
```{r}
169169
hhs_forecast <- hhs_archive %>% epix_as_of(forecast_date)
170170
all_geos <- hhs_forecast %>% distinct(geo_value) %>% pull(geo_value)
171171
hhs_forecast %>% filter(!is.na(hhs)) %>% group_by(geo_value) %>% summarize(n_points = n()) %>% arrange(n_points)
172-
all_geos_forecasts <- map(all_geos, \(geo) forecast_aheads(\(x, ahead) scaled_pop(x, "hhs", ahead = ahead), epi_data = hhs_forecast %>% filter(geo_value == geo)))
173-
all_geos_forecasts %>% list_rbind() %>% plot_forecasts(default_geos)
172+
all_geos_forecasts <- map(all_geos, \(geo) forecast_aheads(\(x, ahead) scaled_pop(x, "hhs", ahead = ahead), epi_data = hhs_forecast %>% filter(geo_value == geo))) %>% list_rbind()
173+
all_geos_forecasts %>% plot_forecasts(default_geos)
174174
```
175175

176-
And the phenomina is still happening
176+
And the phenomena is still happening, at least for the default geos.
177+
Are most negative?
178+
179+
```{r}
180+
geos_gr <- get_growth_rates(all_geos_forecasts, quantiles = 0.5, method = "smooth_spline")
181+
geos_gr %>% arrange(desc(growth))
182+
```
183+
This is at least more of a mixed bag, with plenty of states with positive growth.
184+
185+
```{r}
186+
geos_gr %>% ggplot(aes(x = growth)) + geom_histogram(bins = 300)
187+
```
188+
But most have a negative growth.
189+
190+
## How different is not geo pooling anyways?
191+
Well it is at least different; how exactly is hard to parse:
192+
```{r}
193+
all_geos_forecasts %>%
194+
left_join(all_forecasts, by = join_by(geo_value, forecast_date, target_end_date, quantile), suffix = c("_geo", "_joint")) %>%
195+
mutate(value = value_geo - value_joint) %>%
196+
select(-value_geo, -value_joint) %>%
197+
filter(geo_value %in% default_geos) %>%
198+
ggplot(aes(x = target_end_date, group = geo_value)) +
199+
geom_point(aes(y = value, color = quantile)) +
200+
facet_wrap(~geo_value, scale = "free")
201+
```
202+
203+
204+
# Direct vs iterative forecasting

0 commit comments

Comments
 (0)