Giter VIP home page Giter VIP logo

o2groups's Introduction

CRAN_Status_Badge

Overview

Effective outbreak control relies on a comprehensive understanding of how diseases spread between affected groups, such as healthcare workers and patients or specific age groups.

We developed an estimator that utilises information on transmission chains (who infected whom), enabling the identification and quantification of transmission patterns between groups (see package linktree)

The o2groups package provides a framework for simulating outbreaks using branching processes specifically designed for scenarios involving multiple groups with various transmission assortativity coefficients (gamma).

The package is still under development and is not yet available on CRAN.

Installation

pacman::p_load_gh("CyGei/o2groups")

The assortativity coefficient

By quantifying the extent to which individuals transmit infections within their own groups, assortativity coefficients offer a means to measure the relative contributions of different groups to transmission. $\gamma$ is defined as the excess probability of a secondary infection taking place within group a compared to random expectations. $\gamma$ values range from 0 (fully disassortative) to โˆž (fully assortative), with 1 indicating homogeneous patterns. For instance, $\gamma$ = 2 indicates that an infected individual from group a is twice as likely to infect an individual from the same group compared to an individual from another group. Conversely, a $\gamma$ of 1/2 means that an infected individual from group a is twice as likely to infect an individual from another group compared to an individual from the same group.

Example

Simulation

We first specify the input parameters for our simulation.

set.seed(123)
duration = 100
group_n = 2
size = c(100, 400)
name = c("HCW", "patient")
gamma = c(2, 0.8)
intro_n = c(1, 3) 
r0 = c(1.7, 2) 
generation_time = c(0, 0.1, 0.2, 0.4, 0.2, 0.1, 0) 
incubation_period = sample(1:14, sum(size), replace = TRUE) 

We then run the outbreak simulation using the simulate_groups function.

set.seed(123)
sim <- simulate_groups(
  duration = duration,
  group_n = group_n,
  size = size,
  name = name,
  gamma = gamma,
  intro_n = intro_n,
  r0 = r0,
  generation_time = generation_time,
  incubation_period = incubation_period
)
head(sim)
##     group     id source source_group date_infection date_onset
## 1     HCW HmPsw2   <NA>         <NA>              0          1
## 2 patient WtYSxS   <NA>         <NA>              0         14
## 3 patient gZ6tF2   <NA>         <NA>              0          4
## 4 patient Kxtgdz   <NA>         <NA>              0          7
## 5 patient aH9xtg Kxtgdz      patient              1         12
## 6     HCW DJE8PP gZ6tF2      patient              2          5
pacman::p_load_gh("reconhub/epicontacts@timeline")
pacman::p_load(ggplot2)
x <- make_epicontacts(linelist = sim[, c("id", "group", "date_onset")],
                      contacts = sim[, c("source_group","source", "id")],
                      id = "id",
                      from = "source",
                      to = "id",
                      directed = TRUE)
plot(
  x,
  x_axis = "date_onset",
  node_size = 2,
  node_color = "group",
  edge_color = "source_group",
  method = "ggplot"
) +
  scale_color_manual(values =  c("HCW" = "orange",
                                 "patient" = "purple"),
                     guide="none")+
  scale_fill_manual(values =  c("HCW" = "orange",
                                "patient" = "purple"))

Estimation using linktree

pacman::p_load_gh("CyGei/linktree")
est <- get_gamma(
  from = sim$source_group,
  to = sim$group,
  f = setNames(size, name)
  )

plot(est)

See package linktree for more details on estimating assortativity coefficients.

o2groups's People

Contributors

cygei avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.