The goal of readsdr is to bridge the design capabilities fromspecialised System Dynamics software with the powerful numerical toolsoffered by R libraries. The package accomplishes this goal by parsing.xmile files (Vensim andStella models) into R objects toconstructnetworks (graph theory), ODEfunctions fordeSolve andStan.
You can install the released version of readsdr fromCRAN with:
install.packages("readsdr")And the development version fromGitHub with:
# install.packages("devtools")devtools::install_github("jandraor/readsdr")library(readsdr)filepath<-system.file("models/","SIR.stmx",package ="readsdr")mdl<-read_xmile(filepath)For reading Vensim models, they must be exported as .xmile.
For information on how to use this package, please check:
=,<>)AND,OR,NOT)If Else Then<,>)Pulse1Step1SMTH1,SMTH3,SMTHNDELAYNABS,SQRTNORMAL3=,<>):AND:,:OR:,:NOT:)IF_THEN_ELSE<,>)Pulse1Pulse Train1Step1SMOOTH,SMOOTH3,SMOOTH3I,SMOOTHIDELAY NABS,SQRTRANDOM NORMAL31 Restricted to Euler integration.
2 These functions cannot be part of more complexmathematical expressions. That is, the auxiliary variable must onlycontain one smoothing function andnothing else.
3 Seed is ignored.
uniflow andnon-negative stock features fromStella arenot supported.
No built-in is supported for translations toStancode.
Modules fromStella arenotsupported.
This package has been instrumental in the following works:
Andrade &Duggan (2023).Anchoring the mean generation time in the SEIR tomitigate biases in\(\Re_0\)estimates due to uncertainty in the distribution of theepidemiological delays.Royal Society OpenScience.
Andrade& Duggan (2022).Inferring the effective reproductive numberfrom deterministic and semi-deterministic compartmental models usingincidence and mobility data.PLOS ComputationalBiology.
Andrade & Duggan(2021).A Bayesian approach to calibrate system dynamics modelsusing Hamiltonian Monte Carlo.System DynamicsReview.
Andrade& Duggan (2020).An evaluation of Hamiltonian Monte Carloperformance to calibrate age-structured compartmental SEIR models toincidence data.Epidemics.
Thanks to:
Duggan,J. (2016).System Dynamics Modeling with R. Springer.