Skip to contents

This is a container object that unifies preprocessing, fitting, prediction, and postprocessing for predictive modeling on epidemiological data. It extends the functionality of a workflows::workflow() to handle the typical panel data structures found in this field. This extension is handled completely internally, and should be invisible to the user. For all intents and purposes, this operates exactly like a workflows::workflow(). For more details and numerous examples, see there.

Usage

epi_workflow(preprocessor = NULL, spec = NULL, postprocessor = NULL)

Arguments

preprocessor

An optional preprocessor to add to the workflow. One of:

spec

An optional parsnip model specification to add to the workflow. Passed on to add_model().

postprocessor

An optional postprocessor to add to the workflow. Currently only frosting is allowed using, add_frosting().

Value

A new epi_workflow object.

See also

workflows::workflow

Examples

jhu <- case_death_rate_subset

r <- epi_recipe(jhu) %>%
  step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
  step_epi_ahead(death_rate, ahead = 7) %>%
  step_epi_lag(case_rate, lag = c(0, 7, 14)) %>%
  step_epi_naomit()

wf <- epi_workflow(r, parsnip::linear_reg())

wf
#> 
#> ══ Epi Workflow ════════════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#> Postprocessor: None
#> 
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 
#> 5 Recipe steps.
#> 1. step_epi_lag()
#> 2. step_epi_ahead()
#> 3. step_epi_lag()
#> 4. step_naomit()
#> 5. step_naomit()
#> 
#> ── Model ───────────────────────────────────────────────────────────────────────
#> Linear Regression Model Specification (regression)
#> 
#> Computational engine: lm 
#> 
#>