infodengue_apply_mem: infodengue_apply_mem —– Function to apply MEM algorithm to...

Description Usage Arguments Value Examples

View source: R/infodengue_apply_mem.R

Description

Function infodengue_apply_mem uses MEM package to generate activity thresholds. Apply MEM algorithm discarding seasons below local pre-epidemic threshold. For each municipality, pre-epidemic (limiar_preseason) threshold has a minimum set at 5 cases. If calculated value falls below that, it is set to 5, with high activity (limiar_epidemico) set to either the 90 as incidence. The alert model uses incidence.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
infodengue_apply_mem(
  mun_list,
  start_year = 2010,
  end_year = as.integer(format(Sys.Date(), "%Y")) - 1,
  write = "no",
  database,
  passwd = NULL,
  i.n.max = 0,
  limiar.preseason = 0.95,
  limiar.epidemico = 0.95,
  i.type.curve = 2,
  i.type.threshold = 2,
  i.type.intensity = 2,
  mincases.pre = 5,
  mincases.pos = 5,
  mincases.epi = 10,
  ...
)

Arguments

mun_list

Vector of municipalities geocode. Default: NULL (i.e., all municipalites)

start_year

Historical data starting year to consider. Default: 0 (i.e., as old as possible)

end_year

Historical data final year to consider. Default: previous year from Sys.Date()

write

Whether results should be saved into project's database. Default: 'no' 'no' return data.table without writing in database. 'db' writes data.table to InfoDengue's database using write.parameters from AlerttTools package.

passwd

database password for writing output to db if write='db'.

i.n.max

Number of points by seasons to be used for pre-epidemic and epidemic regions to calculate each threshold. If 0 (default), uses all points in those regions. Else, uses n max values in each region per season. This value is passed to i.n.max parameter in memmodel, from MEM package.

limiar.preseason

Level of confidence interval to calculate pre/post-season thresholds. Default: 0.9. This value is passed to i.level.threshold parameter in memmodel, from MEM package.

limiar.epidemico

Level of confidence interval to calculate high activity during epidemic region. Default: 0.95. This value is passed to i.level.intensity parameter in memmodel, from MEM package.

mincases.pre

minimum number of cases to launch a preseason alert. Default: 5

mincases.epi

minimum number of cases to launch an epidemic alert. Default: 10

...

Optional arguments passed to memmodel, from MEM package.

con

Connection to PostGreSQL database, using dbConnect from RPostgreSQL package

Value

Function info.dengue.apply.mem will return a list with thresholds calculated by mem, by simple percentile and the choice used in the infodengue model, by municipality:

mem: threshold values calculated by mem

municipio_geocodigo = geocode, inc_preseason = preseason incidence threshold, inc_posseason = pos-season incidence threshold, inc_epidemico = high incidence threshold, inicio and inicio.ic = estimated begining of the season duracao, duracao.ic = season duration. ano_inicio and ano_fim used for calculation.

percentiles: threshold values calculated as percentiles (incidence)

quant_pre = preseason incidence threshold, quant_pos = posseason incidence threshold, quant_epidemico = epidemic incidence threshold.

min_threshold_inc:

pre-defined minimum threshold.

threshold: values used by Infodengue

MEM's values if cases > min.cases, percentiles otherwise: limiar_preseason, limiar_posseason, limiar_epidemico.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Generate thresholds for municipalities using the whole history.
Return object instead of writing to data base:
mun_list <- c(4212650, 4209102,4216503,4214607,4212502,4218905,4212601,4214805,
4212650,4217006,4212700,4214706,4213104,4200804)
mun_list <- getCidades(uf = "Maranhão", datasource=con)$municipio_geocodigo
thres <- infodengue_apply_mem(mun_list[1:2], database=con)

A nice way to visualize the calculated thresholds
plot(thres)

Write to database instead of returning object requires password:
thres <- infodengue_apply_mem(con=cond, passwd=password, mun_list=mun_list[1:10])

claudia-codeco/AlertTools documentation built on Aug. 12, 2021, 9:58 a.m.