uofuepibio / epiworldr Goto Github PK
View Code? Open in Web Editor NEWA general framework for quick epidemiological ABM models
Home Page: https://uofuepibio.github.io/epiworldR/
License: Other
A general framework for quick epidemiological ABM models
Home Page: https://uofuepibio.github.io/epiworldR/
License: Other
The epiworld C++ library has many predefined models. These should be included directly via R wrappers. The list of models to add is:
This list will grow, eventually. I'll start with the first one.
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.
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?
run_multiple
.ModelDiffNet
module; probabilities are not as expected.plot_reproductive_number(...)
ellipsis is not clear.plot_generation_time(...)
.Reported by @AnibalLuciano.
Hey @gvegayon, I was unable to solve the epiworldR compiling issue after pulling the latest version of epiworld.
The documentation needs to be updated for generation time. When there is no transmission, generation time will be -1.
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.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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.