cmu-delphi / epipredict

Tools for building predictive models in epidemiology.
https://cmu-delphi.github.io/epipredict/
Other
8 stars 8 forks source link

`step_lag_difference` example should be a little clearer #347

Closed dsweber2 closed 1 week ago

dsweber2 commented 1 week ago

This example should filter out NA's so it demonstrates the behavior better https://cmu-delphi.github.io/epipredict/reference/step_lag_difference.html

#> Warning: ! No training data was supplied to `prep()`.
#> ! Unlike a <recipe>, an <epi_recipe> does not
#> ! store the full template data in the object.
#> ! Please supply the training data to the `prep()` function,
#> ! to avoid addtional warning messages.
#> An `epi_df` object, 20,496 x 8 with metadata:
#> * geo_type  = state
#> * time_type = day
#> * as_of     = 2022-05-31 19:08:25.791826
#> 
#> # A tibble: 20,496 × 8
#>    geo_value time_value case_rate death_rate lag_diff_7_case_rate
#>  * <chr>     <date>         <dbl>      <dbl>                <dbl>
#>  1 ak        2020-12-31      35.9      0.158                   NA
#>  2 al        2020-12-31      65.1      0.438                   NA
#>  3 ar        2020-12-31      66.0      1.27                    NA
#>  4 as        2020-12-31       0        0                       NA
#>  5 az        2020-12-31      76.8      1.10                    NA
#>  6 ca        2020-12-31      96.0      0.751                   NA
#>  7 co        2020-12-31      35.8      0.649                   NA
#>  8 ct        2020-12-31      52.1      0.819                   NA
#>  9 dc        2020-12-31      31.0      0.601                   NA
#> 10 de        2020-12-31      65.2      0.807                   NA
#> # ℹ 20,486 more rows
#> # ℹ 3 more variables: lag_diff_14_case_rate <dbl>, lag_diff_7_death_rate <dbl>,
#> #   lag_diff_14_death_rate <dbl>