infodengue_apply_mem_agreg: Function 'infodengue_apply_mem' uses MEM package to generate...

View source: R/infodengue_apply_mem.R

infodengue_apply_mem_agregR Documentation

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.

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.

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

infodengue_apply_mem_agreg(
  mun_list,
  start_year = 2010,
  end_year = as.integer(format(Sys.Date(), "%Y")) - 1,
  nome = "x",
  database,
  passwd = NULL,
  i.n.max = 0,
  cid10 = "A90",
  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,
  ...
)

mem_curve(
  mun_list,
  start_year = 2010,
  end_year = as.integer(format(Sys.Date(), "%Y")) - 1,
  nome = "x",
  database,
  passwd = NULL,
  i.n.max = 0,
  cid10 = "A90",
  limiar.preseason = 0.95,
  limiar.epidemico = 0.95,
  i.type.curve = 2,
  i.type.threshold = 2,
  i.type.intensity = 2,
  ...
)

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()

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.

cid10

cid 10 code. Dengue = "A90" (default), Chik = "A92.0", Zika = "A92.8"

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.

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.

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.

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

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 = "Rio de Janeiro", regional = "Metropolitana I", datasource=con)
thres <- infodengue_apply_mem_agreg(mun_list$municipio_geocodigo, cid10 = "A92.0")
mun_list <- getCidades(uf = "Rio de Janeiro", regional = "Metropolitana I", datasource=con)
thres <- mem_curve(mun_list$municipio_geocodigo, cid10 = "A92.0")
thres <- mem_curve(muns)

AlertaDengue/AlertTools documentation built on Nov. 27, 2024, 11:55 p.m.