This is the fit()
method for an epi_workflow
object that
estimates parameters for a given model from a set of data.
Fitting an epi_workflow
involves two main steps, which are
preprocessing the data and fitting the underlying parsnip model.
Usage
# S3 method for class 'epi_workflow'
fit(object, data, ..., control = workflows::control_workflow())
Arguments
- object
an
epi_workflow
object- data
an
epi_df
of predictors and outcomes to use when fitting theepi_workflow
- ...
Not used
- control
A
workflows::control_workflow()
object
Examples
jhu <- case_death_rate_subset %>%
filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))
r <- epi_recipe(jhu) %>%
step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
step_epi_ahead(death_rate, ahead = 7)
wf <- epi_workflow(r, parsnip::linear_reg()) %>% fit(jhu)
wf
#>
#> ══ Epi Workflow [trained] ══════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#> Postprocessor: None
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#>
#> 2 Recipe steps.
#> 1. step_epi_lag()
#> 2. step_epi_ahead()
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#>
#> Call:
#> stats::lm(formula = ..y ~ ., data = data)
#>
#> Coefficients:
#> (Intercept) lag_0_death_rate lag_7_death_rate lag_14_death_rate
#> 0.32848 -0.01957 -0.02176 -0.05895
#>
#>