{"id":13857497,"url":"https://github.com/jandraor/readsdr","last_synced_at":"2025-10-22T03:53:16.433Z","repository":{"id":46240280,"uuid":"205191444","full_name":"jandraor/readsdr","owner":"jandraor","description":"Translate System Dynamics models (Stella, Vensim) into R","archived":false,"fork":false,"pushed_at":"2024-05-25T19:33:35.000Z","size":606,"stargazers_count":19,"open_issues_count":4,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-22T03:53:06.390Z","etag":null,"topics":["r","stan","system-dynamics"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jandraor.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-29T15:15:30.000Z","updated_at":"2024-11-22T19:05:51.000Z","dependencies_parsed_at":"2024-01-15T23:17:51.736Z","dependency_job_id":"1ed419f4-7f4a-4c9f-90c3-035992710dcf","html_url":"https://github.com/jandraor/readsdr","commit_stats":{"total_commits":265,"total_committers":3,"mean_commits":88.33333333333333,"dds":0.007547169811320753,"last_synced_commit":"d5d608becf05228a2becbfc62caaf6c1fc2c9765"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jandraor/readsdr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandraor%2Freadsdr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandraor%2Freadsdr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandraor%2Freadsdr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandraor%2Freadsdr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jandraor","download_url":"https://codeload.github.com/jandraor/readsdr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandraor%2Freadsdr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280376538,"owners_count":26320276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","stan","system-dynamics"],"created_at":"2024-08-05T03:01:38.900Z","updated_at":"2025-10-22T03:53:16.415Z","avatar_url":"https://github.com/jandraor.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# readsdr\n\n\u003c!-- badges: start --\u003e\n[![Codecov test\ncoverage](https://codecov.io/gh/jandraor/readsdr/branch/master/graph/badge.svg)](https://app.codecov.io/gh/jandraor/readsdr?branch=master)\n[![CRAN status](https://www.r-pkg.org/badges/version/readsdr)](https://CRAN.R-project.org/package=readsdr)\n[![R-CMD-check](https://github.com/jandraor/readsdr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jandraor/readsdr/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nThe goal of readsdr is to bridge the design capabilities from specialised\nSystem Dynamics software with the powerful numerical tools offered by R \nlibraries. The package accomplishes this goal by parsing .xmile files \n(Vensim and [Stella](https://www.iseesystems.com/) models) into R objects to\nconstruct [networks](https://igraph.org) (graph theory), ODE functions for \n[deSolve](http://desolve.r-forge.r-project.org/) and \n[Stan](https://mc-stan.org/).\n\n## Installation\n\nYou can install the released version of readsdr from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"readsdr\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"jandraor/readsdr\")\n```\n\n## Usage\n\n```{r example}\nlibrary(readsdr)\nfilepath \u003c- system.file(\"models/\", \"SIR.stmx\", package = \"readsdr\")\nmdl      \u003c- read_xmile(filepath) \n```\n\nVensim models can only be read if they are exported in the .xmile format. \nSometimes, Vensim .xmile files can be problematic, where **some stocks may not \nhave flows**, and flow equations are put as initial values. One way to address \nthis issue is by copying the .mdl file to a different folder and exporting the \n.xmile file again. If you encounter this issue, please let the developers know \nat Vensim's [forum](https://www.ventanasystems.co.uk/forum).\n\n## Tutorials\n\nFor information on how to use this package, please check:\n\n* [Basics](https://jandraor.github.io/tutorials/Basics.html)\n\n* [Inference](https://jandraor.github.io/tutorials/Inference.html)\n\n## Supported builtins\n\n* **Stella**\n    + Comparison operators (`=`, `\u003c\u003e`)\n    + Logical operators (`AND`, `OR`, `NOT`) \n    + `If Else Then`\n    + Inequality operators (`\u003c`, `\u003e`)\n    + `Pulse` ^1^\n    + `Step` ^1^\n    + Endogenous table functions\n    + Smoothing functions^2^: `SMTH1`, `SMTH3`, `SMTHN`\n    + Delay functions: `DELAYN`\n    + Limited support to *uni-dimensional* arrays. *Apply all* translation is restricted to numeric values.\n    + Math functions: `ABS`, `EXP`, `SQRT` \n    + Stats functions: `NORMAL`^3^\n* **Vensim**\n    + Comparison operators (`=`, `\u003c\u003e`)\n    + Logical operators (`:AND:`, `:OR:`, `:NOT:`) \n    + `IF_THEN_ELSE`\n    + Inequality operators (`\u003c`, `\u003e`) \n    + `Pulse` ^1^\n    + `Pulse Train` ^1^\n    + `Step` ^1^\n    + Endogenous table functions\n    + Smoothing functions^2^: `SMOOTH`, `SMOOTH3`, `SMOOTH3I`, `SMOOTHI` \n    + Delay functions: `DELAY N`\n    + Math functions: `ABS`, `EXP`, `SQRT` \n    + Limited support to *bi-dimensional* arrays.\n    + Stats functions: `RANDOM NORMAL`^3^\n    \n^1^ Restricted to Euler integration.\n\n^2^ These functions cannot be part of more complex mathematical expressions. That is, the auxiliary variable must only contain one smoothing function and **nothing else**.\n\n^3^ Seed is ignored.\n\n## Notes\n\n* *uniflow* and *non-negative* stock features from _Stella_ are **not** supported.\n\n* No built-in is supported for translations to _Stan_ code.\n\n* Modules from _Stella_ are **not** supported.\n\n\n## Applications\n\nThis package has been instrumental in the following works:\n\n* [Andrade et al (2024)](https://doi.org/10.1002/sdr.1775). _Preparing for pandemic response in the context of limited resources_.  **System Dynamics Review**.\n\n* [Andrade \u0026 Duggan (2023)](https://doi.org/10.1098/rsos.230515). _Anchoring the mean generation time in the SEIR to mitigate biases in_ $\\Re_0$ _estimates due to uncertainty in the distribution of the epidemiological delays_. **Royal Society Open Science**.\n\n* [Andrade \u0026 Duggan (2022)](https://doi.org/10.1371/journal.pcbi.1010206). _Inferring the effective reproductive number from deterministic and semi-deterministic compartmental models using incidence and mobility data_. **PLOS Computational Biology**.\n\n* [Andrade \u0026 Duggan (2021)](https://doi.org/10.1002/sdr.1693). _A Bayesian approach to calibrate system dynamics models using Hamiltonian Monte Carlo_. **System Dynamics Review**.\n\n* [Andrade \u0026 Duggan (2020)](https://doi.org/10.1016/j.epidem.2020.100415). _An evaluation of Hamiltonian Monte Carlo performance to calibrate age-structured compartmental SEIR models to incidence data_. **Epidemics**.\n\n\n## Acknowledgments\n\nThanks to:\n\n* [Rogelio Oliva](http://people.tamu.edu/~roliva/) for advocating the need to\n  create an open-source tool for the System Dynamics community and push forward \n  this endeavour.\n* Sergey Naumov for his ideas to implement several functions in this package.\n* [Jim Duggan](https://github.com/JimDuggan) \n  from whom I borrowed ideas to implement this package.\n\n## References\n\n[Duggan, J. (2016). *System Dynamics Modeling with R*. Springer.](https://link.springer.com/book/10.1007/978-3-319-34043-2)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandraor%2Freadsdr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjandraor%2Freadsdr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandraor%2Freadsdr/lists"}