aeddo {aeddo}R Documentation

Automated and Early Detection of Disease Outbreaks

Description

[Stable]

This function performs automated an early detection of disease outbreaks, (aeddo), on a time series data set. It utilizes hierarchical models in an innovative manner to infer one-step ahead random effects. In turn, these random effects are used directly to characterize an outbreak.

Usage

aeddo(
  data = data.frame(),
  formula = formula(),
  k = integer(),
  sig_level = 0.95,
  exclude_past_outbreaks = TRUE,
  init_theta = numeric(),
  lower = numeric(),
  upper = numeric(),
  method = "BFGS"
)

Arguments

data

A tibble containing the time series data, including columns 'y' for observed values,'n' for population size, and other covariates of interest.

formula

A model formula for the fixed effects in the hierarchical model to fit to the data.

k

An integer specifying the rolling window size employed for parameter estimation.

sig_level

The quantile from the random effects distribution used for defining the for outbreak detection threshold, a numeric value between 0 and 1.

exclude_past_outbreaks

logical value indicating whether past outbreak related observations should be excluded from future parameter estimation.

init_theta

Initial values for model parameters in optimization.

lower

Lower bounds for optimization parameters.

upper

Upper bounds for optimization parameters.

method

The optimization method to use, either "BFGS" (default) or "L-BFGS-B".

Value

A tibble-like 'aedseo' object containing:

Examples

# Create an example aedseo_tsd object
aeddo_data <- data.frame(
  time = as.Date(c(
    "2023-01-01",
    "2023-01-02",
    "2023-01-03",
    "2023-01-04",
    "2023-01-05",
    "2023-01-06"
  )),
  y = c(100, 120, 180, 110, 130, 140),
  n = 1
)

# Supply a model formula
fixed_effects_formula <- y ~ 1

# Choose a size for the rolling window
k <- 2
# ... and quantile for the threshold
sig_level <- 0.9

# Employ the algorithm
aeddo_results <- aeddo(
  data = aeddo_data,
  formula = fixed_effects_formula,
  k = k,
  sig_level = sig_level,
  exclude_past_outbreaks = TRUE,
  init_theta = c(1, 0),
  lower = c(-Inf, 1e-6),
  upper = c(Inf, 1e2),
  method = "L-BFGS-B"
)
# Print the results
print(aeddo_results)

[Package aeddo version 0.1.1 Index]