File tree 2 files changed +4
-7
lines changed
_casestudies/forecast-covid
2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,7 @@ epi_pred_cv_trailing <- epi_slide(
422
422
.ref_time_values = fc_time_values,
423
423
.new_col_name = "fc"
424
424
) |>
425
+ # split tibble-type column `fc` into multiple columns with names prefixed by `fc_`:
425
426
unpack(fc, names_sep = "_")
426
427
427
428
# they match exactly
Original file line number Diff line number Diff line change @@ -2035,10 +2035,8 @@ nowcast_res <- archive |>
2035
2035
epix_slide(
2036
2036
.f = lm_mod_pred,
2037
2037
.before = 14, # 14-day training period
2038
- .versions = ref_time_values,
2039
- .new_col_name = "res"
2038
+ .versions = ref_time_values
2040
2039
) |>
2041
- unnest() |> # Nesting creates a list-column of data frames; unnesting flattens it back out into regular columns.
2042
2040
mutate(targeted_nowcast_date = targeted_nowcast_dates, time_value = actual_nowcast_date) |>
2043
2041
ungroup()
2044
2042
@@ -2425,10 +2423,8 @@ nowcast_res <- archive |>
2425
2423
epix_slide(
2426
2424
.f = lm_mod_pred, # Pass the function defined above
2427
2425
.before = 30, # Training period of 30 days
2428
- .versions = ref_time_values, # Determines the day where training data goes up to (not inclusive)
2429
- .new_col_name = "res"
2426
+ .versions = ref_time_values # Determines the day where training data goes up to (not inclusive)
2430
2427
) |>
2431
- unnest() |>
2432
2428
mutate(targeted_nowcast_date = targeted_nowcast_dates,
2433
2429
time_value = actual_nowcast_date)
2434
2430
@@ -2583,4 +2579,4 @@ cowplot::plot_grid(p1, p2)
2583
2579
2584
2580
* Group built [ ` {rtestim} ` ] ( https://dajmcdon.github.io/rtestim ) doing for this nonparametrically.
2585
2581
2586
- * We may come back to this later...
2582
+ * We may come back to this later...
You can’t perform that action at this time.
0 commit comments