{"id":32199959,"url":"https://github.com/ropensci/dynamite","last_synced_at":"2026-02-23T14:02:11.043Z","repository":{"id":38690579,"uuid":"488277823","full_name":"ropensci/dynamite","owner":"ropensci","description":"Bayesian Inference of Complex Panel Data","archived":false,"fork":false,"pushed_at":"2026-02-01T12:41:31.000Z","size":209413,"stargazers_count":35,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-01T22:11:44.775Z","etag":null,"topics":["bayesian-inference","panel-data","r","r-package","rstats","stan","statistical-models"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/dynamite/","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/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","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-03T16:09:29.000Z","updated_at":"2026-02-01T12:41:35.000Z","dependencies_parsed_at":"2024-01-18T08:38:06.400Z","dependency_job_id":"8e0cf221-3a19-4bb6-95f3-ceee83d90a22","html_url":"https://github.com/ropensci/dynamite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/dynamite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fdynamite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fdynamite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fdynamite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fdynamite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/dynamite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fdynamite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29745111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: 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":["bayesian-inference","panel-data","r","r-package","rstats","stan","statistical-models"],"created_at":"2025-10-22T03:33:57.387Z","updated_at":"2026-02-23T14:02:11.037Z","avatar_url":"https://github.com/ropensci.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  fig.align = \"center\",\n  fig.width = 9, \n  fig.height = 6\n)\n```\n\n```{r srr-tags, eval = FALSE, echo = FALSE}\n#' @srrstats {G1.1,  G1.2}\n```\n\n# dynamite: Bayesian Modeling and Causal Inference for Multivariate Longitudinal Data \u003ca href=\"https://docs.ropensci.org/dynamite/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\"/\u003e\u003c/a\u003e\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[![R-CMD-check](https://github.com/ropensci/dynamite/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/dynamite/actions)\n[![Codecov test coverage](https://codecov.io/gh/ropensci/dynamite/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/dynamite?branch=main)\n[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/554_status.svg)](https://github.com/ropensci/software-review/issues/554)\n[![dynamite status badge](https://ropensci.r-universe.dev/badges/dynamite)](https://ropensci.r-universe.dev)\n[![dynamite CRAN badge](https://www.r-pkg.org/badges/version/dynamite)](https://cran.r-project.org/package=dynamite)\n\u003c!-- badges: end --\u003e\n\nThe `dynamite` [R](https://www.r-project.org/) package provides an easy-to-use interface for Bayesian inference of complex panel (time series) data comprising of multiple measurements per multiple individuals measured in time via dynamic multivariate panel models (DMPM). The main features distinguishing the package and the underlying methodology from many other approaches are:\n\n* Support for regular time-invariant effects, group-level random effects, and time-varying effects modeled via Bayesian P-splines.\n* Joint modeling of multiple measurements per individual (multiple channels) based directly on the assumed data-generating process. Individual channels can be univariate or multivariate.\n* Support for various distributions: Currently Gaussian, Multivariate Gaussian, Student t, Categorical, Ordered, Multinomial, Poisson, Bernoulli, Binomial, Negative Binomial, Gamma, Exponential, and Beta distributions are available, and these can be combined arbitrarily in multichannel models.\n* Allows evaluating realistic long-term counterfactual predictions that take into account the dynamic structure of the model by efficient posterior predictive distribution simulation.\n* Transparent quantification of parameter and predictive uncertainty due to a fully Bayesian approach.\n* Various visualization methods including a method for drawing and producing a TikZ code of the directed acyclic graph (DAG) of the model structure.\n* User-friendly and efficient R interface with state-of-the-art estimation via Stan. Both `rstan` and `cmdstanr` backends are supported, with both parallel chains and within-chain parallelization.\n\nThe `dynamite` package is developed with the support of the Research Council of Finland grant 331817 ([PREDLIFE](https://sites.utu.fi/predlife/en/)). For further information on DMPMs and the `dynamite` package, see the related papers:\n\n* Helske J. and Tikka S. (2024). Estimating Causal Effects from Panel Data with Dynamic Multivariate Panel Models. *Advances in Life Course Research*, 60, 100617. ([Journal version](https://doi.org/10.1016/j.alcr.2024.100617), [SocArXiv preprint](https://doi.org/10.31235/osf.io/mdwu5))\n* Tikka S. and Helske J. (2025). `dynamite`: An R Package for Dynamic Multivariate Panel Models. *Journal of Statistical Software*, 115(5), 1-42. ([Journal version](https://doi.org/10.18637/jss.v115.i05), [arXiv preprint](https://arxiv.org/abs/2302.01607))\n\n## Installation\n\nYou can install the most recent stable version of `dynamite` from [CRAN](https://cran.r-project.org/package=dynamite) or the development version from [R-universe](https://r-universe.dev/search) by running one the following lines:\n\n```{r packages, eval = FALSE}\ninstall.packages(\"dynamite\")\ninstall.packages(\"dynamite\", repos = \"https://ropensci.r-universe.dev\")\n```\n\n## Example\n\nA single-channel model with time-invariant effect of `z`, time-varying effect of `x`, lagged value of the response variable `y` and a group-specific random intercepts:\n\n```{r load, echo = FALSE}\nlibrary(\"dynamite\")\nggplot2::theme_set(ggplot2::theme_bw())\n```\n\n```{r fit, eval = FALSE}\nset.seed(1)\nlibrary(\"dynamite\")\ngaussian_example_fit \u003c- dynamite(\n  obs(y ~ -1 + z + varying(~ x + lag(y)) + random(~1), family = \"gaussian\") +\n    splines(df = 20),\n  data = gaussian_example, time = \"time\", group = \"id\",\n  iter = 2000, chains = 2, cores = 2, refresh = 0\n)\n```\n\n```{r update, echo = FALSE}\nset.seed(1)\nlibrary(\"dynamite\")\ngaussian_example_fit \u003c- update(\n  gaussian_example_fit,\n  iter = 2000, warmup = 1000, thin = 1,\n  chains = 2, cores = 2, refresh = 0\n)\n```\n\nSummary of the model:\n```{r summary}\nprint(gaussian_example_fit)\n```\n\nPosterior estimates of time-varying effects:\n```{r posterior, fig.width = 9, fig.height = 4}\nplot(gaussian_example_fit, types = c(\"alpha\", \"delta\"), scales = \"free\")\n```\n\nAnd group-specific intercepts (for first 10 groups):\n```{r random, fig.width = 9, fig.height = 4}\nplot(gaussian_example_fit, types = \"nu\", groups = 1:10)\n```\n\nTraceplots and density plots for time-invariant parameters:\n```{r trace, fig.width = 9, fig.height = 4}\nplot(gaussian_example_fit, plot_type = \"trace\", types = \"beta\")\n```\n\nPosterior predictive samples for the first 4 groups (using the samples based on the posterior distribution of the model parameters and observed data on the first time point):\n```{r prediction, warning=FALSE, fig.width = 9, fig.height = 4}\nlibrary(\"ggplot2\")\npred \u003c- predict(gaussian_example_fit, n_draws = 100)\npred |\u003e\n  dplyr::filter(id \u003c 5) |\u003e\n  ggplot(aes(time, y_new, group = .draw)) +\n  geom_line(alpha = 0.25) +\n  # observed values\n  geom_line(aes(y = y), colour = \"tomato\") +\n  facet_wrap(~id) +\n  theme_bw()\n```\n\nVisualizing the model structure as a DAG (a snapshot at time `t`):\n```{r dag, fig.width = 4, fig.height = 4}\nplot(gaussian_example_fit, plot_type = \"dag\", show_covariates = TRUE)\n```\n\nFor more examples, see the package vignettes and the [blog post about dynamite](https://ropensci.org/blog/2023/01/31/dynamite-r-package/).\n\n## Related packages\n\n- The `dynamite` package uses Stan via [`rstan`](https://CRAN.R-project.org/package=rstan) and [`cmdstanr`](https://mc-stan.org/cmdstanr/) (see also https://mc-stan.org), which is a probabilistic programming language for general Bayesian modelling.\n- The [`brms`](https://CRAN.R-project.org/package=brms) package also uses Stan, and can be used to fit various complex multilevel models.\n- Regression modeling with time-varying coefficients based on kernel smoothing and least squares estimation is available in package [`tvReg`](https://CRAN.R-project.org/package=tvReg). The [`tvem`](https://CRAN.R-project.org/package=tvem) package provides similar functionality for gaussian, binomial and poisson responses with [`mgcv`](https://CRAN.R-project.org/package=mgcv) backend.\n- [`plm`](https://CRAN.R-project.org/package=plm) contains various methods to estimate linear models for panel data, e.g., fixed effect models.\n- [`lavaan`](https://CRAN.R-project.org/package=lavaan) provides tools for structural equation modeling, and as such can be used to model various panel data models as well.\n\n## Contributing\n\nContributions are very welcome, see [CONTRIBUTING.md](https://github.com/ropensci/dynamite/blob/main/.github/CONTRIBUTING.md) for general guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fdynamite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fdynamite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fdynamite/lists"}