epi_adapt_timeserie: Create an Endemic Channel

Description Usage Arguments Value Functions Examples

View source: R/cdc_channel.R

Description

Exploratory Alarm Tool for Outbreak Detection.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
epi_adapt_timeserie(db_disease, db_population, var_admx, var_year,
  var_week, var_event_count, var_population)

epi_create_channel(time_serie, disease_name = "disease_name",
  method = "gmean_1sd")

epi_join_channel(disease_channel, disease_now, adm_columns = NULL)

epi_plot_channel(joined_channel, n_breaks = 10)

epi_observe_alert(joined_channel, threshold = upp_95,
  alert_distance = 3)

Arguments

db_disease

disease surveillance datasets

db_population

estimated population for each adm area

var_admx

administrative code r name as string

var_year

year of agregated observations

var_week

week of agregated observations

var_event_count

number of events per week-year

var_population

estimated population at that year

time_serie

time serie

disease_name

free code name of diseases

method

specify the method. "gmean_1sd" is geometric mean w/ 1 standard deviation (default). "gmean_2sd" is gmean w/ 2 sd. "gmean_ci" is gmean w/ 95 percent confidence intervals.

disease_channel

salida de epi_*_mutate

disease_now

nueva base de vigilancia

adm_columns

dataframe with names of the administrative code or name strings

joined_channel

base de datos unida

n_breaks

number of breaks in x axis

Value

canal endemico, union y grafico

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
library(tidyverse)

# import data -------------------------------------------------------------

denv <-
  readr::read_csv("https://dengueforecasting.noaa.gov/Training/Iquitos_Training_Data.csv") %>%
  mutate(year = lubridate::year(week_start_date),
         epiweek = lubridate::epiweek(week_start_date)) %>%
  mutate(adm="iquitos") %>%
  # cases per season - replace wiht a dummy year
  mutate(year = str_replace(season,"(.+)/(.+)","\\1") %>% as.double())

# denv %>% count(year,season,lag_year)

denv %>% glimpse()

# denv %>%
#   ggplot(aes(x = week_start_date,y = total_cases)) +
#   geom_col()

popdb <-
  readr::read_csv("https://dengueforecasting.noaa.gov/PopulationData/Iquitos_Population_Data.csv") %>%
  janitor::clean_names() %>%
  mutate(adm="iquitos")

popdb %>% glimpse()

# popdb %>% count(year)
# denv %>% count(year)
# denv %>% left_join(popdb)

# first, adapt ------------------------------------------------------------

epi_adapted <-
  epi_adapt_timeserie(db_disease = denv,
                      db_population = popdb,
                      var_admx = adm,
                      # var_year = year, # must be a common variable between datasets
                      # var_week = epiweek,
                      var_year = year, # not working - need to create pseudo-years
                      var_week = season_week,
                      var_event_count = total_cases,
                      var_population = estimated_population)

# second, filter ----------------------------------------------------------

disease_now <- epi_adapted %>%
  filter(var_year==max(var_year))

disease_pre <- epi_adapted %>%
  filter(var_year!=max(var_year))

# third, create -----------------------------------------------------------

disease_channel <-
  epi_create_channel(time_serie = disease_pre,
                     disease_name = "denv")

disease_channel

# fourth, ggplot it -------------------------------------------------------

epi_join_channel(disease_channel = disease_channel,
                 disease_now = disease_now) %>%
  # ggplot
  epi_plot_channel() +
  labs(title = "Dengue virus Endemic Channel. Iquitos, Peru 2008/2009",
       caption = "Source: https://dengueforecasting.noaa.gov/",
       # x = "epiweeks",
       x = "Seasonal week",
       y = "Number of cases") +
  theme_bw()

avallecam/epichannel documentation built on Dec. 26, 2020, 10 p.m.