Skip to content

Commit fc4dad6

Browse files
committed
some more editing
1 parent 0a03683 commit fc4dad6

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ four_week_ahead <- arx_forecaster(
222222
four_week_ahead
223223
#> ══ A basic forecaster of type ARX Forecaster ════════════════════════════════
224224
#>
225-
#> This forecaster was fit on 2025-02-05 17:01:43.
225+
#> This forecaster was fit on 2025-02-10 12:09:58.
226226
#>
227227
#> Training data was an <epi_df> with:
228228
#> • Geography: state,

vignettes/custom_epiworkflows.Rmd

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ data.
283283

284284
There are many ways we could modify `four_week_ahead`; one simple modification
285285
would be to include a growth rate estimate as part of the model.
286-
Another would be to include a time component to the prediction (useful if we
287-
expect there to be a strong seasonal component).
288286
Another would be to convert from rates to counts, for example if that were the
289287
preferred prediction format.
288+
Another would be to include a time component to the prediction (useful if we
289+
expect there to be a strong seasonal component).
290290

291291
## Growth rate
292292

293293
One feature that may potentially improve our forecast is looking at the growth
294-
rate
294+
rate
295295

296296
```{r growth_rate_recipe}
297297
growth_rate_recipe <- epi_recipe(
@@ -305,12 +305,17 @@ growth_rate_recipe <- epi_recipe(
305305
step_epi_naomit() |>
306306
step_training_window()
307307
```
308+
308309
Inspecting the newly added column:
310+
309311
```{r growth_rate_print}
310312
growth_rate_recipe |>
311313
prep(training_data) |>
312314
bake(training_data) |>
313-
select(geo_value, time_value, case_rate, death_rate, gr_7_rel_change_death_rate)
315+
select(
316+
geo_value, time_value, case_rate,
317+
death_rate, gr_7_rel_change_death_rate
318+
)
314319
```
315320
And the role:
316321
```{r growth_rate_roles}
@@ -320,7 +325,7 @@ prepped$term_info |> filter(grepl("gr", variable))
320325
```
321326

322327
To demonstrate the changes in the layers that come along with it, we will use
323-
`quantile_reg()` as the model:
328+
`quantile_reg()` as the model, which requires changing from `layer_residual_quantiles()` to `layer_quantile_distn()` and `layer_point_from_distn()`:
324329
```{r layer_and_fit}
325330
growth_rate_layers <- frosting() |>
326331
layer_predict() |>
@@ -347,14 +352,17 @@ gr_predictions <- gr_fit_workflow |>
347352
```
348353
<details>
349354
<summary> Plot </summary>
355+
356+
Plotting the result; this is reusing some code from the landing page to print
357+
the forecast date.
358+
350359
```{r plotting}
351-
# plotting the result
352360
forecast_date_label <-
353361
tibble(
354362
geo_value = rep(used_locations, 2),
355363
.response_name = c(rep("case_rate", 4), rep("death_rate", 4)),
356364
dates = rep(forecast_date - 7 * 2, 2 * length(used_locations)),
357-
heights = c(rep(150, 4), rep(0.40, 4))
365+
heights = c(rep(150, 4), rep(0.30, 4))
358366
)
359367
360368
result_plot <- autoplot(
@@ -379,11 +387,6 @@ result_plot
379387

380388
TODO `get_test_data` isn't actually working here...
381389

382-
[^1]: Think of baking a cake, where adding the frosting is the last step in the process of actually baking.
383-
384-
[^2]: Note that the frosting doesn't require any information about the training
385-
data, since the output of the model only depends on the model used.
386-
387390
## Population scaling
388391

389392
Suppose we're sending our predictions to someone who is looking to understand
@@ -425,3 +428,8 @@ which are 2-3 orders of magnitude larger than the corresponding rates above.
425428
`df` represents the scaling value; in this case it is the state populations,
426429
while `rate_rescaling` gives the denominator of the rate (our fit values were
427430
per 100,000).
431+
432+
[^1]: Think of baking a cake, where adding the frosting is the last step in the process of actually baking.
433+
434+
[^2]: Note that the frosting doesn't require any information about the training
435+
data, since the output of the model only depends on the model used.

0 commit comments

Comments
 (0)