Git Product home page Git Product logo

uofuepibio / epiworldr Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 3.0 47.69 MB

A general framework for quick epidemiological ABM models

Home Page: https://uofuepibio.github.io/epiworldR/

License: Other

R 48.49% C++ 34.88% Makefile 0.69% C 0.04% M4 2.23% HTML 12.79% Shell 0.01% TeX 0.66% Dockerfile 0.20%
abm agent-based-modeling rpack rpkg simulation covid-19 epidemics epidemiology r-package r-programming

epiworldr's People

Contributors

abinashbunty avatar derekmeyer37 avatar gvegayon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

epiworldr's Issues

Write a wrapper of the `models` namespace

The epiworld C++ library has many predefined models. These should be included directly via R wrappers. The list of models to add is:

  • sis
  • sir
  • seir
  • sirconnected
  • seirconnected

This list will grow, eventually. I'll start with the first one.

SIGSEGV in ModelSEIR when removing virus

I am getting the following error when running playground/benchmark-seir.R using R -gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4466fcc in epiworld::default_rm_virus<int> (a=..., model=0x555558435ee0) at ../inst/include/epiworld/agent-actions-meat.hpp:114
114         model->get_db().today_virus[v->get_id()][p->state_prev]--;

This happens on the speedup PR.

Specifications of first infected in ModelDiffNet

I was making a model for opinion diffusion with ModelDiffNet(), where each node has the following attribute: a real number beta between 0 and 1, following a certain distribution. But, for the model, its important that the first infecterd meet the condition beta<0.2. This restriction of selection in early infected individuals cannot be accomplished with the current packege in R, epiworldR. Can you adapt the C++ code to allow this kind of escenarios?

Sunbelt issues

  • Set a unique id for each run in run_multiple.
  • OpenMP not working properly with a high number of threads.
  • Review the ModelDiffNet module; probabilities are not as expected.

Improve docs in plot functions

  • plot_reproductive_number(...) ellipsis is not clear.
  • Same happens to the plot_generation_time(...).
  • Both need documentation regarding what the (invisible) output is.

Reported by @AnibalLuciano.

Methods

We need to have the following methods:

  • plot: Draw a figure showing the counts (y-axis) throughout the dates (x-axis). It should be similar to what it is implemented right now here. In particular, we will need one method for each class like we do here:
#' @rdname ModelSEIR
#' @export
plot.epiworld_seir <- function(x, y = NULL, ...) {
  ...[do magic]...
}
  • plot_r: Plot the overall reproductive number (see here). This should have a new generic, since the function plot_r does not exist.

Higher contact rate error

result <- suppressWarnings(suppressMessages(invisible({
  
  library(epiworldR)
  
  library(data.table)
  library(EpiEstim)
  library(dplyr)
  library(ggplot2)
  library(tidyverse)
  library(EpiNow2)
})))


model_seircon=ModelSEIRCONN(name="covid",n=50000,prevalence = 0.001,contact_rate = 20,transmission_rate = 0.5,recovery_rate = 1/7,incubation_days = 3)





run(model_seircon,ndays=50,seed=1912)
#> _________________________________________________________________________
#> |Running the model...
#> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
#> | done.
summary(model_seircon)
#> ________________________________________________________________________________
#> ________________________________________________________________________________
#> SIMULATION STUDY
#> 
#> Name of the model   : Susceptible-Exposed-Infected-Removed (SEIR) (connected)
#> Population size     : 50000
#> Agents' data        : (none)
#> Number of entities  : 0
#> Days (duration)     : 50 (of 50)
#> Number of viruses   : 1
#> Last run elapsed t  : 473.00ms
#> Last run speed      : 5.28 million agents x day / second
#> Rewiring            : off
#> 
#> Global events:
#>  (none)
#> 
#> Virus(es):
#>  - covid (baseline prevalence: 0.10%)
#> 
#> Tool(s):
#>  (none)
#> 
#> Model parameters:
#>  - Avg. Incubation days : 3.0000
#>  - Contact rate         : 20.0000
#>  - Prob. Recovery       : 0.1429
#>  - Prob. Transmission   : 0.5000
#> 
#> Distribution of the population at time 50:
#>   - (0) Susceptible : 49950 -> 0
#>   - (1) Exposed     :    50 -> 0
#>   - (2) Infected    :     0 -> 140
#>   - (3) Recovered   :     0 -> 49860
#> 
#> Transition Probabilities:
#>  - Susceptible  0.60  0.40  0.00  0.00
#>  - Exposed      0.00  0.66  0.34  0.00
#>  - Infected     0.00  0.00  0.86  0.14
#>  - Recovered    0.00  0.00  0.00  1.00



plot(model_seircon)



saver <- make_saver(
  "total_hist",
  "transmission",
  "transition",
  "reproductive",
  "generation"
)
run_multiple(model_seircon,ndays=50,nsim=100,seed=1972,saver=saver)
#> Starting multiple runs (100) using 1 thread(s)
#> _________________________________________________________________________
#> _________________________________________________________________________
#> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
#>  done.


res1 <- run_multiple_get_results(model_seircon)
#> Warning in run_multiple_get_results(model_seircon): When retrieving the saved
#> results, for the case of transmission, there were no observations.
#> Error in attributes(.Data) <- c(attributes(.Data), attrib): all attributes must have names [4 does not]
res1$reproductive
#> Error in eval(expr, envir, enclos): object 'res1' not found

First steps

  • Create a skeleton package (empty) using either Rcpp or cpp11 (describe the reasoning behind your decision.)
  • Upload the package to GitHub.
  • Create a README.Rmd file for the package. Use the description of https://github.com/UofUEpi/epiworld.

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.