Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default growth_rate produces weird jumps around low-activity periods #389

Open
brookslogan opened this issue Dec 13, 2023 · 1 comment
Open

Comments

@brookslogan
Copy link
Contributor

library(tidyverse)
library(epidatr)
library(epiprocess)
#> 
#> Attaching package: 'epiprocess'
#> The following object is masked from 'package:stats':
#> 
#>     filter
cce <- covidcast_epidata()
mi_latest <- cce$signals$"hhs:confirmed_admissions_influenza_1d"$call("state","mi","*")
mi_latest %>%
  as_epi_df() %>%
  mutate(gr = growth_rate(time_value, value)) %>%
  ggplot(aes(time_value, gr)) %>%
  `+`(geom_line())
#> Warning: Removed 230 rows containing missing values (`geom_line()`).

Untitled

Created on 2023-12-13 with reprex v2.0.2

@brookslogan
Copy link
Contributor Author

brookslogan commented Dec 13, 2023

cowplot::plot_grid(
           mi_latest %>%
           ggplot(aes(time_value, value)) %>%
           `+`(geom_line()),
           mi_latest %>%
           as_epi_df() %>%
           mutate(gr = growth_rate(time_value, value)) %>%
           ggplot(aes(time_value, gr)) %>%
           `+`(geom_line()),
           ncol = 1L,
           align = "v"
         )
#> Warning messages:
#> 1: Removed 156 rows containing missing values (`geom_line()`). 
#> 2: Removed 230 rows containing missing values (`geom_line()`). 

mi_vert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant