Skip to content

Modelling transmission on real-world social networks

License

Notifications You must be signed in to change notification settings

epiverse-trace/epinetwork

 
 

Repository files navigation

Modelling transmission and control on real-world networks.

This repository is currently under development. It is a fork of the {covidhm} repository, which in turn was adapted from the {ringbp} package. The aim of this new repository is to allow development for more general use cases beyond COVID, with the original repo remaining as the accompaniment to the initial 2020 published COVID analysis.

Unlike {ringbp}, which simulates using branching processes, the model in this repo allows simulation of outbreaks on empirical networks, and hence accounting for clustering of contacts – although {simulist} also includes an option to approximate some clustering effects). This makes it particularly well suited to outbreaks in closed settings and small communities. However, given active development happening on ringbp, which informed this network model, this repository should be considered a placeholder for now.

These are the two main published applications of this model:

The below are the set-up instructions from the original {covidhm} repo.

Usage

Set up

Install the analysis:

Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE)
devtools::install("covidhm-master",dependencies = TRUE)

Run a single scenario and plot a network

Run a single instance of the outbreak model over 20 days and overlay the infection data onto a network. See ?plot_network for details of parameters

library(covidhm)

#Load association matrices
load("data-raw/am_list.RData")

#First item in the list is data across all days
m <- am_list[[1]]

#Plot network
plot_network(
am = m,
day = 20,
num.initial.cases = 1,
prop.asym = 0.4,
delay_shape =  1,
delay_scale = 1.4,
prop.ascertain = 0.9,
presymrate = 0.2,
R = 0.8,
outside = 0.001,
testing = FALSE,
s = 333,
isolation = FALSE,
secondary = FALSE,
tracing = FALSE,
quarantine = FALSE)

Run a single scenario multiple times

Run a single scenario for 10 simulations. Use ?scenario_sim for an explanation of parameters.

library(covidhm)
library(ggplot2)

res <- scenario_sim(net = m, n.sim = 10, num.initial.cases = 1,prop.asym=0.4,
                             prop.ascertain = 0.9, cap_max_days = 70,
                             delay_shape = 1, delay_scale = 1.4, R = 0.8, presymrate = 0.2, scenario = "nothing",
                             testing = FALSE, outside = 0.001, distancing = 0)

# Plot of raw cumulative cases
ggplot(data=res, aes(x=week, y=cumcases,col = sim)) +
geom_line(show.legend = FALSE, alpha=0.6, aes(group = sim)) +
scale_y_continuous(name="Weekly number of cases") +
  theme_bw()

Run the full analysis

Run the analyses in the terminal with the following commands (NB - these take several hours):

Rscript inst/scripts/scenarios.R
Rscript inst/scripts/network.R
Rscript inst/scripts/distancing.R
Rscript inst/scripts/outside.R
Rscript inst/scripts/testing.R
Rscript inst/scripts/sensitivity_testing.R

Generate figures

Render figures with the following:

Rscript inst/scripts/figures.R

About

Modelling transmission on real-world social networks

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%