Package: SimInf 10.1.0.9000

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> or the Particle Markov Chain Monte Carlo ('PMCMC') algorithm of 'Andrieu' and others (2010) <doi:10.1111/j.1467-9868.2009.00736.x>.

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_10.1.0.9000.tar.gz
SimInf_10.1.0.9000.zip(r-4.7)SimInf_10.1.0.9000.zip(r-4.6)SimInf_10.1.0.9000.zip(r-4.5)
SimInf_10.1.0.9000.tgz(r-4.6-x86_64)SimInf_10.1.0.9000.tgz(r-4.6-arm64)SimInf_10.1.0.9000.tgz(r-4.5-x86_64)SimInf_10.1.0.9000.tgz(r-4.5-arm64)
SimInf_10.1.0.9000.tar.gz(r-4.7-arm64)SimInf_10.1.0.9000.tar.gz(r-4.7-x86_64)SimInf_10.1.0.9000.tar.gz(r-4.6-arm64)SimInf_10.1.0.9000.tar.gz(r-4.6-x86_64)
SimInf_10.1.0.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
SimInf/json (API)
NEWS

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

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

Pkgdown/docs site:https://stewid.github.io

Uses libs:
  • gsl– GNU Scientific Library (GSL)
  • openmp– GCC OpenMP (GOMP) support library
Datasets:
  • events_SISe3 - Example event data for the SISe3 model with cattle herds
  • nodes - Example data with spatial distribution of nodes
  • u0_SISe3 - Example initial population data for the SISe3 model

On CRAN:

Conda:

data-drivenepidemiologyhigh-performance-computingmarkov-chainmathematical-modellinggslopenmp

10.24 score 37 stars 202 scripts 368 downloads 10 mentions 59 exports 4 dependencies

Last updated from:788bb3a283. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK195
linux-devel-x86_64OK207
source / vignettesOK230
linux-release-arm64OK190
linux-release-x86_64OK198
macos-release-arm64OK165
macos-release-x86_64OK321
macos-oldrel-arm64OK158
macos-oldrel-x86_64OK305
windows-develOK224
windows-releaseOK192
windows-oldrelOK214
wasm-releaseOK122

Exports:abcadd_spatial_coupling_to_ldataboxplotC_codecontinue_abccontinue_pmcmcdistance_matrixedge_properties_to_matrixeventsevents_SEIRevents_SIRevents_SISgdatagdata<-get_individualsindegreeindividual_eventslambertW0ldatalogLikmparsen_compartmentsn_generationsn_nodesn_replicatesnode_eventsoutdegreepackage_skeletonpairspfilterplotpmcmcprevalencepunchcard<-runSEIRselect_matrixselect_matrix<-set_num_threadsshift_matrixshift_matrix<-showSimInf_eventsSimInf_modelSIRSISSISeSISe_spSISe3SISe3_spsummarytrajectoryu0u0_from_individual_eventsu0_SEIRu0_SIRu0_SISu0<-v0<-

Dependencies:digestlatticeMASSMatrix

Getting started with mparse

Rendered frommparse.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-04-14
Started: 2021-02-06

Post-process data in a trajectory

Rendered frompost-process-data.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-04-07
Started: 2021-02-06

Scheduled events

Rendered fromscheduled-events.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-04-07
Started: 2021-02-06

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

Rendered fromSimInf.Rnwusingutils::Sweaveon May 30 2026.

Last update: 2026-04-14
Started: 2017-03-26

Readme and manuals

Help Manual

Help pageTopics
Approximate Bayesian computationabc abc,SimInf_model-method
Add spatial coupling information to local dataadd_spatial_coupling_to_ldata
Coerce a 'SimInf_abc' object to a 'data.frame'as.data.frame.SimInf_abc
Coerce a 'SimInf_events' object to a 'data.frame'as.data.frame.SimInf_events
Coerce a 'SimInf_individual_events' object to a 'data.frame'as.data.frame.SimInf_individual_events
Coerce a 'SimInf_pmcmc' object to a 'data.frame'as.data.frame.SimInf_pmcmc
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_abc continue_abc,SimInf_abc-method
Continue PMCMC from an Existing Chaincontinue_pmcmc continue_pmcmc,SimInf_pmcmc-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 scheduled events from a 'SimInf_model' objectevents events,SimInf_model-method
Example event data for the SEIR model with cattle herdsevents_SEIR
Example event data for the SIR model with cattle herdsevents_SIR
Example event data for the SIS model with cattle herdsevents_SIS
Example event data for the SISe3 model with cattle herdsevents_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_individual_events'get_individuals get_individuals,SimInf_individual_events-method
Determine in-degree for each node in a modelindegree
Individual eventsindividual_events
Lambert W0 functionlambertW0
Extract local data from a nodeldata ldata,SimInf_model-method
Length of the MCMC chainlength,SimInf_pmcmc-method
Log likelihoodlogLik,SimInf_pfilter-method
Model parser to define new models for 'SimInf'mparse
Determine the number of compartments in a modeln_compartments n_compartments,SimInf_model-method
Determine the number of generations in an ABC analysisn_generations n_generations,SimInf_abc-method
Determine the number of nodes in a modeln_nodes n_nodes,SimInf_model-method n_nodes,SimInf_pfilter-method n_nodes,SimInf_pmcmc-method
Determine the number of replicates in a modeln_replicates n_replicates,SimInf_model-method
Transform individual events to node events for a modelnode_events node_events,SimInf_individual_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 matrix 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_individual_events-method
Display the outcome from a simulated trajectoryplot,SimInf_model-method
Diagnostic plot of a particle filter objectplot,SimInf_pfilter-method
Display the PMCMC posterior distributionplot,SimInf_pmcmc-method
Particle Markov chain Monte Carlo (PMCMC) algorithmpmcmc pmcmc,SimInf_model-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
Extract prevalence from fitting a PMCMC algorithmprevalence,SimInf_pmcmc-method
Set a sparse recording template for simulation resultspunchcard<- 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
Class SEIRSEIR-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_individual_events' objectshow,SimInf_individual_events-method
Brief summary of 'SimInf_model'show,SimInf_model-method
Brief summary of a 'SimInf_pfilter' objectshow,SimInf_pfilter-method
Brief summary of a 'SimInf_pmcmc' objectshow,SimInf_pmcmc-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_individual_events'SimInf_individual_events-class
Create a 'SimInf_model' objectSimInf_model
Class 'SimInf_model'SimInf_model-class
Class '"SimInf_pfilter"'SimInf_pfilter-class
Class 'SimInf_pmcmc'SimInf_pmcmc-class
Create an SIR modelSIR
Class SIRSIR-class
Create an SIS modelSIS
Class SISSIS-class
Create an SISe modelSISe
Create an SISe_sp modelSISe_sp
Class SISe_spSISe_sp-class
Class SISeSISe-class
Create a 'SISe3' modelSISe3
Create an SISe3_sp modelSISe3_sp
Class SISe3_spSISe3_sp-class
Class SISe3SISe3-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_individual_events' objectsummary,SimInf_individual_events-method
Detailed summary of a 'SimInf_model' objectsummary,SimInf_model-method
Detailed summary of a 'SimInf_pfilter' objectsummary,SimInf_pfilter-method
Detailed summary of a 'SimInf_pmcmc' objectsummary,SimInf_pmcmc-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 state ('u0') in each nodeu0 u0,SimInf_model-method
Derive the initial compartment state from individual eventsu0_from_individual_events u0_from_individual_events,data.frame-method u0_from_individual_events,SimInf_individual_events-method
Example initial population data for the SEIR modelu0_SEIR
Example initial population data for the SIR modelu0_SIR
Example initial population data for the SIS modelu0_SIS
Example initial population data for 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