Skip to contents

This function performs the actual E/I estimation for a single location using surveillance data and epidemiological parameters, following the engine's reporting chain: a report on day d is a symptomatic onset on day d - tau_r, and all onsets (symptomatic and asymptomatic) are reported * chi / (rho * sigma).

Usage

est_initial_E_I_location(
  cases,
  dates,
  population,
  t0,
  lookback_days = 60,
  lookahead_days = 0,
  sigma,
  rho,
  chi,
  tau_r,
  iota,
  gamma_1,
  gamma_2,
  verbose = FALSE
)

Arguments

cases

Vector of daily suspected cholera cases (must be same length as dates); NA marks a day without a report

dates

Vector of dates corresponding to cases (Date class)

population

Total population of the location (must be positive)

t0

Target date for estimation (Date class)

lookback_days

Days of reports before t0 to use (default 60, must be positive)

lookahead_days

Days of reports from t0 onward that also enter the onset rate (default 0, non-negative). The onset rate is averaged over the days of the window of lookback_days + lookahead_days days that carry a count (a day with NA, or with no row, is unobserved, not zero); only reports before t0 enter I directly (later ones are onsets that have not happened yet or that the rate fill-in already covers).

sigma

Symptomatic proportion (must be in (0,1])

rho

Reporting rate - proportion of symptomatic cases reported (must be in (0,1])

chi

Diagnostic positivity - proportion of suspected cases that are true cholera (must be in (0,1])

tau_r

Reporting delay in days from symptom onset to report (must be non-negative; rounded to whole days as in the engine)

iota

Incubation rate (1/incubation period, must be positive)

gamma_1

Symptomatic recovery rate (must be positive)

gamma_2

Asymptomatic recovery rate (must be positive)

verbose

Print detailed progress (default FALSE)

Value

A list with two components:

E

Number of individuals in Exposed compartment (non-negative numeric)

I

Number of individuals in Infected compartment (non-negative numeric)

Returns E=0, I=0 if no cases in the window. Includes numerical stability protections and parameter validation. Warns if E or I exceed 2% of population.

Details

  • I: observed onsets that have not yet recovered at t0 (per-day survival exp(-gamma_1) for the symptomatic share sigma, exp(-gamma_2) for the rest), plus the onsets the window cannot see, filled in at the window's mean onset rate: those in the last tau_r days before t0 (reported on or after t0), those on window days before t0 without a count, and those older than the window.

  • E: people infected before t0 whose onset comes after t0. A reported case is already past E, so E is the stock in balance with the window's mean onset rate \(\lambda\): \(E = \lambda / (1 - e^{-\iota})\), the engine's daily E-to-I probability (Azman et al. 2013 for the incubation period behind iota).

Examples

if (FALSE) { # \dontrun{
# Example with synthetic data
cases <- rpois(60, lambda = 5)
dates <- seq(as.Date("2023-01-01"), by = "day", length.out = 60)
result <- est_initial_E_I_location(
  cases = cases,
  dates = dates,
  population = 1000000,
  t0 = as.Date("2023-03-01"),
  sigma = 0.125,
  rho = 0.1,
  chi = 0.5,
  tau_r = 4,
  iota = 0.714,
  gamma_1 = 0.2,
  gamma_2 = 0.67
)
} # }