Package: SimInf 9.8.1

Stefan Widgren

SimInf: A Framework for Data-Driven Stochastic Disease Spread Simulations

Provides an efficient and very flexible framework to conduct data-driven epidemiological modeling in realistic large scale disease spread simulations. The framework integrates infection dynamics in subpopulations as continuous-time Markov chains using the Gillespie stochastic simulation algorithm and incorporates available data such as births, deaths and movements as scheduled events at predefined time-points. Using C code for the numerical solvers and 'OpenMP' (if available) to divide work over multiple processors ensures high performance when simulating a sample outcome. One of our design goals was to make the package extendable and enable usage of the numerical solvers from other R extension packages in order to facilitate complex epidemiological research. The package contains template models and can be extended with user-defined models. For more details see the paper by Widgren, Bauer, Eriksson and Engblom (2019) <doi:10.18637/jss.v091.i12>. The package also provides functionality to fit models to time series data using the Approximate Bayesian Computation Sequential Monte Carlo ('ABC-SMC') algorithm of Toni and others (2009) <doi:10.1098/rsif.2008.0172>.

Authors:Stefan Widgren [aut, cre], Robin Eriksson [aut], Stefan Engblom [aut], Pavol Bauer [aut], Thomas Rosendal [ctb], Ivana Rodriguez Ewerlöf [ctb], Attractive Chaos [cph]

SimInf_9.8.1.tar.gz
SimInf_9.8.1.tar.gz(r-4.5-noble)SimInf_9.8.1.tar.gz(r-4.4-noble)
SimInf_9.8.1.tgz(r-4.4-emscripten)SimInf_9.8.1.tgz(r-4.3-emscripten)
SimInf.pdf |SimInf.html
SimInf/json (API)
NEWS

# Install 'SimInf' in R:
install.packages('SimInf', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/stewid/siminf/issues

Uses libs:
  • gsl– GNU Scientific Library (GSL)
  • openmp– GCC OpenMP (GOMP) support library
Datasets:
  • events_SISe3 - Example data to initialize events for the 'SISe3' model
  • nodes - Example data with spatial distribution of nodes
  • u0_SISe3 - Example data to initialize the 'SISe3' model

6.30 score 2 stars 224 scripts 528 downloads 10 mentions 54 exports 4 dependencies

Last updated 6 months agofrom:94b2d7b70c. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKNov 21 2024
R-4.5-linux-x86_64OKNov 21 2024

Exports:abcboxplotC_codecontinuedistance_matrixedge_properties_to_matrixeventsevents_SEIRevents_SIRevents_SISevents_SISegdatagdata<-get_individualsindegreeindividual_eventsldatalogLikmparsen_generationsn_nodesnode_eventsoutdegreepackage_skeletonpairspfilterplotprevalencepunchcard<-runSEIRselect_matrixselect_matrix<-set_num_threadsshift_matrixshift_matrix<-showSimInf_eventsSimInf_modelSIRSISSISeSISe_spSISe3SISe3_spsummarytrajectoryu0u0_SEIRu0_SIRu0_SISu0_SISeu0<-v0<-

Dependencies:digestlatticeMASSMatrix

Post-process data in a trajectory

Rendered frompost-process-data.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2024-04-24
Started: 2024-04-24

Scheduled events

Rendered fromscheduled-events.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2024-04-24
Started: 2021-06-25

SimInf: An R Package for Data-Driven Stochastic Disease Spread Simulations

Rendered fromSimInf.Rnwusingutils::Sweaveon Nov 21 2024.

Last update: 2022-09-03
Started: 2017-06-13

Readme and manuals

Help Manual

Help pageTopics
Approximate Bayesian computationabc abc,SimInf_model-method
Coerce to data frameas.data.frame.SimInf_abc
Coerce events to a data frameas.data.frame.SimInf_events
Coerce to data frameas.data.frame.SimInf_indiv_events
Box plot of number of individuals in each compartmentboxplot,SimInf_model-method
Extract the C code from a 'SimInf_model' objectC_code
Run more generations of ABC SMCcontinue continue,SimInf_abc-method
Create a distance matrix between nodes for spatial modelsdistance_matrix
Convert an edge list with properties to a matrixedge_properties_to_matrix
Extract the events from a 'SimInf_model' objectevents events,SimInf_model-method
Example data to initialize events for the 'SEIR' modelevents_SEIR
Example data to initialize events for the 'SIR' modelevents_SIR
Example data to initialize events for the 'SIS' modelevents_SIS
Example data to initialize events for the 'SISe' modelevents_SISe
Example data to initialize events for the 'SISe3' modelevents_SISe3
Extract global data from a 'SimInf_model' objectgdata gdata,SimInf_model-method
Set a global data parameter for a 'SimInf_model' objectgdata<- gdata<-,SimInf_model-method
Extract individuals from 'SimInf_indiv_events'get_individuals get_individuals,SimInf_indiv_events-method
Determine in-degree for each node in a modelindegree
Individual eventsindividual_events
Extract local data from a nodeldata ldata,SimInf_model-method
Log likelihoodlogLik,SimInf_pfilter-method
Model parser to define new models to run in 'SimInf'mparse
Determine the number of generationsn_generations n_generations,SimInf_abc-method
Determine the number of nodes in a modeln_nodes n_nodes,SimInf_model-method
Transform individual events to node events for a modelnode_events node_events,SimInf_indiv_events-method
Example data with spatial distribution of nodesnodes
Determine out-degree for each node in a modeloutdegree
Create a package skeleton from a 'SimInf_model'package_skeleton
Scatterplot of number of individuals in each compartmentpairs,SimInf_model-method
Bootstrap particle filterpfilter pfilter,SimInf_model-method
Display the ABC posterior distributionplot,SimInf_abc-method
Display the distribution of scheduled events over timeplot,SimInf_events-method
Display the distribution of individual events over timeplot,SimInf_indiv_events-method
Display the outcome from a simulated trajectoryplot,SimInf_model-method
Diagnostic plot of a particle filter objectplot,SimInf_pfilter-method
Generic function to calculate prevalence from trajectory dataprevalence
Calculate prevalence from a model object with trajectory dataprevalence,SimInf_model-method
Extract prevalence from running a particle filterprevalence,SimInf_pfilter-method
Set a template for where to record result during a simulationpunchcard<- punchcard<-,SimInf_model-method
Run the SimInf stochastic simulation algorithmrun run,SEIR-method run,SimInf_abc-method run,SimInf_model-method run,SIR-method run,SIS-method run,SISe-method run,SISe3-method run,SISe3_sp-method run,SISe_sp-method
Create an SEIR modelSEIR
Definition of the 'SEIR' modelSEIR-class
Extract the select matrix from a 'SimInf_model' objectselect_matrix select_matrix,SimInf_model-method
Set the select matrix for a 'SimInf_model' objectselect_matrix<- select_matrix<-,SimInf_model-method
Specify the number of threads that SimInf should useset_num_threads
Extract the shift matrix from a 'SimInf_model' objectshift_matrix shift_matrix,SimInf_model-method
Set the shift matrix for a 'SimInf_model' objectshift_matrix<- shift_matrix<-,SimInf_model-method
Print summary of a 'SimInf_abc' objectshow,SimInf_abc-method
Brief summary of 'SimInf_events'show,SimInf_events-method
Print summary of a 'SimInf_indiv_events' objectshow,SimInf_indiv_events-method
Brief summary of 'SimInf_model'show,SimInf_model-method
Brief summary of a 'SimInf_pfilter' objectshow,SimInf_pfilter-method
A Framework for Data-Driven Stochastic Disease Spread SimulationsSimInf-package SimInf
Class '"SimInf_abc"'SimInf_abc-class
Create a 'SimInf_events' objectSimInf_events
Class '"SimInf_events"'SimInf_events-class
Class '"SimInf_indiv_events"'SimInf_indiv_events-class
Create a 'SimInf_model'SimInf_model
Class '"SimInf_model"'SimInf_model-class
Class '"SimInf_pfilter"'SimInf_pfilter-class
Create an SIR modelSIR
Definition of the SIR modelSIR-class
Create an SIS modelSIS
Definition of the SIS modelSIS-class
Create a SISe modelSISe
Create a 'SISe_sp' modelSISe_sp
Definition of the 'SISe_sp' modelSISe_sp-class
Definition of the 'SISe' modelSISe-class
Create a 'SISe3' modelSISe3
Create an 'SISe3_sp' modelSISe3_sp
Definition of the 'SISe3_sp' modelSISe3_sp-class
Definition of the 'SISe3' modelSISe3-class
Detailed summary of a 'SimInf_abc' objectsummary,SimInf_abc-method
Detailed summary of a 'SimInf_events' objectsummary,SimInf_events-method
Detailed summary of a 'SimInf_indiv_events' objectsummary,SimInf_indiv_events-method
Detailed summary of a 'SimInf_model' objectsummary,SimInf_model-method
Detailed summary of a 'SimInf_pfilter' objectsummary,SimInf_pfilter-method
Generic function to extract data from a simulated trajectorytrajectory
Extract data from a simulated trajectorytrajectory,SimInf_model-method
Extract filtered trajectory from running a particle filtertrajectory,SimInf_pfilter-method
Get the initial compartment stateu0 u0,SimInf_indiv_events-method u0,SimInf_model-method
Example data to initialize the 'SEIR' modelu0_SEIR
Example data to initialize the 'SIR' modelu0_SIR
Example data to initialize the 'SIS' modelu0_SIS
Example data to initialize the 'SISe' modelu0_SISe
Example data to initialize the 'SISe3' modelu0_SISe3
Update the initial compartment state u0 in each nodeu0<- u0<-,SimInf_model-method
Update the initial continuous state v0 in each nodev0<- v0<-,SimInf_model-method