{"id":32206217,"url":"https://github.com/robindenz1/simdag","last_synced_at":"2026-04-02T19:02:24.136Z","repository":{"id":186932748,"uuid":"487841450","full_name":"RobinDenz1/simDAG","owner":"RobinDenz1","description":"An R-Package to Simulate Data from a (Time-Dependent) Causal DAG","archived":false,"fork":false,"pushed_at":"2026-03-30T11:42:10.000Z","size":19286,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-30T13:27:11.620Z","etag":null,"topics":["causal-inference","directed-acyclic-graph","simulation"],"latest_commit_sha":null,"homepage":"https://robindenz1.github.io/simDAG/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobinDenz1.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"codemeta.json","zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-02T12:46:07.000Z","updated_at":"2026-03-30T07:08:03.000Z","dependencies_parsed_at":"2023-11-07T15:27:28.003Z","dependency_job_id":"6d5e0904-05b6-4cf2-b8f0-db34850c76cb","html_url":"https://github.com/RobinDenz1/simDAG","commit_stats":null,"previous_names":["robindenz1/simdag"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/RobinDenz1/simDAG","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobinDenz1%2FsimDAG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobinDenz1%2FsimDAG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobinDenz1%2FsimDAG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobinDenz1%2FsimDAG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobinDenz1","download_url":"https://codeload.github.com/RobinDenz1/simDAG/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobinDenz1%2FsimDAG/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["causal-inference","directed-acyclic-graph","simulation"],"created_at":"2025-10-22T05:08:34.605Z","updated_at":"2026-04-02T19:02:24.122Z","avatar_url":"https://github.com/RobinDenz1.png","language":"R","funding_links":[],"categories":[],"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\n\u003c!-- badges: start --\u003e\n[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![](https://www.r-pkg.org/badges/version/simDAG?color=green)](https://cran.r-project.org/package=simDAG)\n[![](http://cranlogs.r-pkg.org/badges/grand-total/simDAG?color=blue)](https://cran.r-project.org/package=simDAG)\n[![R-CMD-check](https://github.com/RobinDenz1/simDAG/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RobinDenz1/simDAG/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/RobinDenz1/simDAG/graph/badge.svg)](https://app.codecov.io/gh/RobinDenz1/simDAG)\n[![](https://img.shields.io/badge/doi-10.48550/arXiv.2506.01498-green.svg)](https://doi.org/10.48550/arXiv.2506.01498)\n\u003c!-- badges: end --\u003e\n\n# simDAG \u003cimg src=\"man/figures/logo.png\" height=\"240\" align=\"right\" /\u003e\n\nAuthor: Robin Denz\n\n## Description\n\n`simDAG` is an R-Package which can be used to generate data from a known directed acyclic graph (DAG) with associated information on distributions and causal coefficients. The root nodes are sampled first and each subsequent child node is generated according to a regression model (linear, logistic, multinomial, cox, ...) or other function. The result is a dataset that has the same causal structure as the specified DAG and by expectation the same distributions and coefficients as initially specified. It also implements a comprehensive framework for conducting discrete-time and discrete-event simulations in a similar fashion and directly supports network dependencies among individuals.\n\n## Installation\n\nA stable version of this package can be installed from CRAN:\n\n```R\ninstall.packages(\"simDAG\")\n```\n\nand the developmental version may be installed from github using the `remotes` R-Package:\n\n```R\nlibrary(remotes)\n\nremotes::install_github(\"RobinDenz1/simDAG\")\n```\n\n## Bug Reports and Feature Requests\n\nIf you encounter any bugs or have any specific feature requests, please file an [Issue](https://github.com/RobinDenz1/simDAG/issues).\n\n## Examples\n\nSuppose we want to generate data with the following causal structure:\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"man/figures/example_DAG.png\" width=\"450\" /\u003e\n\u003c/p\u003e\n\nwhere `age` is normally distributed with a mean of 50 and a standard deviation of 4 and `sex` is bernoulli distributed with `p = 0.5` (equal number of men and women). Both of these \"root nodes\" (meaning they have no parents - no arrows pointing into them) have a direct causal effect on the `bmi`. The causal coefficients are 1.1 and 0.4 respectively, with an intercept of 12 and a sigma standard deviation of 2. `death` is modeled as a bernoulli variable, which is caused by both `age` and `bmi` with causal coefficients of 0.1 and 0.3 respectively. As intercept we use -15.\n\nThe following code can be used to generate 10000 samples from these specifications:\n\n```{r}\nlibrary(simDAG)\n\ndag \u003c- empty_dag() +\n  node(\"age\", type=\"rnorm\", mean=50, sd=4) +\n  node(\"sex\", type=\"rbernoulli\", p=0.5) +\n  node(\"bmi\", type=\"gaussian\", formula= ~ 12 + age*1.1 + sex*0.4, error=2) +\n  node(\"death\", type=\"binomial\", formula= ~ -15 + age*0.1 + bmi*0.3)\n\nset.seed(42)\n\nsim_dat \u003c- sim_from_dag(dag, n_sim=100000)\n```\n\nBy fitting appropriate regression models, we can check if the data really does approximately conform to our specifications. First, lets look at the `bmi`:\n\n```{r}\nmod_bmi \u003c- glm(bmi ~ age + sex, data=sim_dat, family=\"gaussian\")\nsummary(mod_bmi)\n```\n\nThis seems about right. Now we look at `death`:\n\n```{r}\nmod_death \u003c- glm(death ~ age + bmi, data=sim_dat, family=\"binomial\")\nsummary(mod_death)\n```\n\nThe estimated coefficients are also very close to the ones we specified. More examples can be found in the documentation and the multiple vignettes.\n\n## Citation\n\nIf you use this package, please cite the associated article:\n\nDenz, Robin and Nina Timmesfeld (2025). Simulating Complex Crossectional and Longitudinal Data using the simDAG R Package. arXiv preprint, doi: 10.48550/arXiv.2506.01498.\n\n## License\n\n© 2024 Robin Denz\n\nThe contents of this repository are distributed under the GNU General Public License. You can find the full text of this License in this github repository. Alternatively, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobindenz1%2Fsimdag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobindenz1%2Fsimdag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobindenz1%2Fsimdag/lists"}