tidybayes  by mjskay

R package for Bayesian analysis, tidy data, and ggplot2 integration

Created 10 years ago
742 stars

Top 46.7% on SourcePulse

GitHubView on GitHub
Project Summary

This R package simplifies integrating Bayesian modeling results into a tidy data workflow, primarily for users of ggplot2. It streamlines data preparation for Bayesian models and transforms complex model outputs into easily visualizable, tidy data frames, enhancing the analysis and presentation of uncertainty.

How It Works

tidybayes leverages the posterior package for handling draws from Bayesian models and ggdist for advanced statistical visualizations. Its core functions, like compose_data and spread_draws, automate the conversion of R data structures into formats suitable for Bayesian modeling software (e.g., Stan, JAGS) and then parse model output (parameter draws, predictions) into tidy data frames. This tidy format, with indices automatically converted back to original data types (like factors), is ideal for dplyr manipulation and ggplot2 plotting, particularly with ggdist geoms like stat_eye and stat_lineribbon.

Quick Start & Requirements

  • Install from CRAN: install.packages("tidybayes")
  • Install from GitHub: devtools::install_github("mjskay/tidybayes")
  • Requires R.

Highlighted Details

  • Automates data preparation for Bayesian models using compose_data.
  • Simplifies extraction and reshaping of model draws into tidy data frames with spread_draws and gather_draws.
  • Provides functions (add_epred_draws, add_predicted_draws) for generating tidy predictions from models.
  • Integrates with ggdist for advanced visualizations like eye plots, quantile dotplots, and uncertainty bands.
  • Offers compatibility functions to translate between tidybayes and other R package formats (e.g., broom, ggmcmc).

Maintenance & Community

  • Developed by Matthew Kay.
  • Feedback and issues can be reported via GitHub.
  • Cites DOI: 10.5281/zenodo.1308151.

Licensing & Compatibility

  • Licensed under GPL-3.0.
  • Compatible with various Bayesian modeling packages including rstan, brms, rstanarm, rjags, and MCMCglmm.

Limitations & Caveats

The package is primarily focused on R and its ecosystem; integration with other statistical software or programming languages is not directly supported. While it supports numerous Bayesian model output formats, users must ensure their model output is compatible with the posterior package's draw formats.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Gabriel Almeida Gabriel Almeida(Cofounder of Langflow), and
5 more.

lit by PAIR-code

0.1%
4k
Interactive ML model analysis tool for understanding model behavior
Created 5 years ago
Updated 3 weeks ago
Feedback? Help us improve.