library(dplyr)
library(lubridate)
library(ggplot2)
flu_season <- seq(make_date(2017, 12, 16), make_date(2018, 1, 16), by = "day")
exclude_dates <- c(flu_season, seq(make_date(2020, 1, 1), today(), by = "day"))
res <- cdc_state_counts %>%
filter(state == "Massachusetts") %>%
compute_expected(exclude = exclude_dates,
keep.components = TRUE)
p <- expected_diagnostic(expected = res, alpha = 0.50)
p$population
p$seasonal
p$trend
p$expected
p$residual
Run the code above in your browser using DataLab