adjustIncidence: Correct incidence data with notification delay (nowcasting).

View source: R/adjust_incidence_functions.R

adjustIncidenceR Documentation

Correct incidence data with notification delay (nowcasting).

Description

This function estimate the time series of reported cases by adding the cases that will be reported in the future.

Usage

adjustIncidence(
  obj,
  datas,
  method = "none",
  pdig = plnorm((1:20) * 7, 2.5016, 1.1013),
  Dmax = 10,
  nyears = 2,
  datasource = con,
  nowSE,
  safelimit = 5,
  ...
)

Arguments

obj

data.frame with crude weekly cases (not adjusted). This data.frame comes from the getCases function (if withdivision = FALSE), of getCases followed by casesinlocality (if dataframe is available per bairro)

datas

data.frame with notification data. Requires: municipio_geocodigo, dt_sin_pro, dt_digita, dt_notific.

method

"bayesian" or "none". The later just repeats case values

pdig

for the "fixedprob" method. It is a vector of probability of been typed in the database up to 1, 2, 3, n, weeks after symptoms onset. DEPRECATED.

Dmax

for the "bayesian" method. Maximum number of weeks that is modeled

nyears

for the "bayesian" method. Number of years of data used for fitting the model

nowSE

for the "bayesian" method. Epidemiological week to be considered for the nowcast. If NA, the maximum SE in obj is used.

safelimit

if median estimate is larger than 'safelimit' times 'sum(tail(cases, n=5))', nowcasting fails.

Value

data.frame with median and 95percent confidence interval for the predicted cases-to-be-notified

Examples

muns <- getCidades(uf = "Acre", regional = "Baixo Acre e Purus")
t1 <- Sys.time()
d <- getCases(cities = muns$municipio_geocodigo, dataini = "sinpri")
d <- getCases(cities = 3302700, dataini = "sinpri")
dd <- d[d$cidade == 1200401,]
t1 <- Sys.time()
resfit0<-adjustIncidence(obj=dd, method = "bayesian", nowSE = 202414, 
interation = TRUE, datasource = con)
t2 <- Sys.time()
message(paste("total time was", t2-t1))
# Using argument 'datas' is good to save time with dataset access
t1 <- Sys.time()
load("caselist.RData")  # output of getCases
resfit<-adjustIncidence(obj=dd, datas = caselist, method = "bayesian", 
nowSE = 202414,datasource = con)
t2 <- Sys.time()

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