Skip to content

Commit 62520ba

Browse files
committed
much more complete guts example, branching flatline fixes
1 parent 9c11756 commit 62520ba

12 files changed

+385
-282
lines changed

R/step_epi_shift.R

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
#' @details The step assumes that the data are already _in the proper sequential
3434
#' order_ for shifting.
3535
#'
36+
#' While `{recipes}` provides a function `step_lag()`, it assumes that the data
37+
#' have no breaks in the sequence of `time_values`, and has no ability to group by
38+
#' `geo_value` or other keys. Our `lag/ahead` functions also appropriately adjust
39+
#' the amount of data to avoid accidentally dropping recent predictors from the
40+
#' test data.
41+
#'
3642
#' The `prefix` and `id` arguments are unchangeable to ensure that the code runs
3743
#' properly and to avoid inconsistency with naming. For `step_epi_ahead`, they
3844
#' are always set to `"ahead_"` and `"epi_ahead"` respectively, while for

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ cases_deaths |>
105105
facet_grid(
106106
rows = vars(.response_name),
107107
cols = vars(geo_value),
108-
scale = "free") +
108+
scale = "free"
109+
) +
109110
scale_x_date(date_breaks = "3 months", date_labels = "%Y %b") +
110111
theme(axis.text.x = element_text(angle = 90, hjust = 1))
111112
```
@@ -177,7 +178,8 @@ forecast_date_label <-
177178
heights = c(rep(150, 4), rep(0.75, 4))
178179
)
179180
processed_data_plot <-
180-
covid_case_death_rates |> filter(geo_value %in% used_locations) |>
181+
covid_case_death_rates |>
182+
filter(geo_value %in% used_locations) |>
181183
autoplot(
182184
case_rate,
183185
death_rate,
@@ -186,7 +188,8 @@ processed_data_plot <-
186188
facet_grid(
187189
rows = vars(.response_name),
188190
cols = vars(geo_value),
189-
scale = "free") +
191+
scale = "free"
192+
) +
190193
geom_vline(aes(xintercept = forecast_date)) +
191194
geom_text(
192195
data = forecast_date_label,
@@ -219,7 +222,7 @@ four_week_ahead <- arx_forecaster(
219222
four_week_ahead
220223
#> ══ A basic forecaster of type ARX Forecaster ════════════════════════════════
221224
#>
222-
#> This forecaster was fit on 2025-01-31 10:46:32.
225+
#> This forecaster was fit on 2025-02-05 17:01:43.
223226
#>
224227
#> Training data was an <epi_df> with:
225228
#> • Geography: state,

_pkgdown.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ articles:
1111
navbar: ~
1212
contents:
1313
- epipredict
14+
- custom_epiworkflows
1415
- preprocessing-and-models
1516
- backtesting
1617
- arx-classifier
-8.25 KB
Loading

vignettes/arx-classifier.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vignette: >
88
---
99

1010
```{r, include = FALSE}
11-
source("_common.R")
11+
source(here::here("vignettes/_common.R"))
1212
```
1313

1414
## Load required packages

vignettes/backtesting.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vignette: >
88
---
99

1010
```{r, include = FALSE}
11-
source("_common.R")
11+
source(here::here("vignettes/_common.R"))
1212
```
1313

1414
```{r pkgs, include=FALSE, echo=TRUE}

0 commit comments

Comments
 (0)