Skip to content

Lack of epidemiological metrics on netdiffuseR #78

@aoliveram

Description

@aoliveram

netdiffuseR currently lacks metrics for epidemiological analysis of contact networks. The diffnet class treats adoption as permanent (like a SI model), hazard_rate() is network-blind, there is no way to store a transmission tree, and stochastic transmission (already in progress on the stochastic-transmission branch) supports only a sigmoid kernel (not well-suited for epidemiological simulations).

What we should do

  1. Time of Disadoption. Add an optional $tod slot to diffnet parallel in shape to $toa. Both should be matrices N × K to handle k reinfection cycles, and be a vector when one episode per node.

  2. Reproductive number. We can construct a native function repr_number() that mirrors epiworldR::get_reproductive_number() exactly: offspring count aggregated by (source, source_exposure_date) from the transmission tree. No other R_0 flavour in this PR.

  3. Supporting epi metrics. secondary_attack_rate(), generation_time(), survival_curve(), peak_prevalence(), peak_time(). All native, and relatively simple once with the adoption tree.

  4. Transmission tree. We should add an optional $transmission slot on diffnet (schema identical to epiworldR::get_transmissions()). Tested first with the Epigames histories.csv and checked if it fits well with the one provided by Andres's scripts.

  5. Stochastic transmission. 1) Generalise the existing stochastic-transmission work: add a pluggable link_fun parameter to allocate a preferred function (linear, sigmoid, Wells-Riley, or a function given by the user); and 2) add a adoption_model = "logit" path in rdiffnet() with beta0 + beta_expo parameters.

Key aspects

  • Zero new dependencies.
  • Backward compatible: When $tod and $transmission are NULL, every existing function returns identical results.

Origin of prior work

This PR integrates two existing branches:

  • stochastic-transmission (link-level Bernoulli, sigmoid kernel).
  • issue-75-epigames-dynamic-attrs (Epigames dataset, dynamic attrs, collapse_timeframes).

Both will be merged into a new issue-XX-epidemiological-metrics branch.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions