Package: tidybayes 3.0.7.9000

tidybayes: Tidy Data and 'Geoms' for Bayesian Models

Compose data for and extract, manipulate, and visualize posterior draws from Bayesian models ('JAGS', 'Stan', 'rstanarm', 'brms', 'MCMCglmm', 'coda', ...) in a tidy data format. Functions are provided to help extract tidy data frames of draws from Bayesian models and that generate point summaries and intervals in a tidy format. In addition, 'ggplot2' 'geoms' and 'stats' are provided for common visualization primitives like points with multiple uncertainty intervals, eye plots (intervals plus densities), and fit curves with multiple, arbitrary uncertainty bands.

Authors:Matthew Kay [aut, cre], Timothy Mastny [ctb]

tidybayes_3.0.7.9000.tar.gz
tidybayes_3.0.7.9000.zip(r-4.5)tidybayes_3.0.7.9000.zip(r-4.4)tidybayes_3.0.7.9000.zip(r-4.3)
tidybayes_3.0.7.9000.tgz(r-4.4-any)tidybayes_3.0.7.9000.tgz(r-4.3-any)
tidybayes_3.0.7.9000.tar.gz(r-4.5-noble)tidybayes_3.0.7.9000.tar.gz(r-4.4-noble)
tidybayes_3.0.7.9000.tgz(r-4.4-emscripten)tidybayes_3.0.7.9000.tgz(r-4.3-emscripten)
tidybayes.pdf |tidybayes.html
tidybayes/json (API)
NEWS

# Install 'tidybayes' in R:
install.packages('tidybayes', repos = c('https://mjskay.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/mjskay/tidybayes/issues

On CRAN:

bayesian-data-analysisbrmsggplot2jagsstantidy-datavisualization

14.82 score 726 stars 18 packages 6.6k scripts 6.4k downloads 21 mentions 221 exports 50 dependencies

Last updated 2 months agofrom:fb49436878. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 17 2024
R-4.5-winOKOct 17 2024
R-4.5-linuxOKOct 17 2024
R-4.4-winOKOct 17 2024
R-4.4-macOKOct 17 2024
R-4.3-winOKOct 17 2024
R-4.3-macOKOct 17 2024

Exports:add_drawsadd_epred_drawsadd_epred_rvarsadd_fitted_drawsadd_fitted_samplesadd_linpred_drawsadd_linpred_rvarsadd_predicted_drawsadd_predicted_rvarsadd_predicted_samplesadd_residual_drawsapply_prototypesas_data_listas_sample_data_frameas_sample_tibbleaxis_titles_bottom_leftcombine_chainscompare_levelscompose_datacurve_intervalcut_cdf_qidata_listdensity_binsdlkjcorr_marginaldstudent_temmeans_comparisonepred_drawsepred_rvarsextract_samplesfacet_title_left_horizontalfacet_title_right_horizontalfitted_drawsfitted_samplesfrom_broom_namesfrom_ggmcmc_namesgather_drawsgather_emmeans_drawsgather_emmeans_samplesgather_lsmeans_samplesgather_pairsgather_rvarsgather_samplesgather_termsgather_variablesgeom_dotsgeom_dotshgeom_dotsintervalgeom_dotsintervalhgeom_eyegeom_eyehgeom_halfeyehgeom_intervalgeom_intervalhgeom_lineribbongeom_pointintervalgeom_pointintervalhgeom_slabgeom_slabhgeom_slabintervalGeomDotsGeomDotsintervalGeomIntervalGeomIntervalhGeomLineribbonGeomPointintervalGeomPointintervalhGeomSlabGeomSlabintervalget_variablesggeyeguide_colorbar2guide_colourbar2hdcihdihistogram_binslinpred_drawslinpred_rvarsmarginalize_lkjcorrmean_hdcimean_hdcihmean_hdimean_hdihmean_qimean_qihmedian_hdcimedian_hdcihmedian_hdimedian_hdihmedian_qimedian_qihModemode_hdcimode_hdcihmode_hdimode_hdihmode_qimode_qihn_prefixnest_rvarsparametersparse_distplkjcorr_marginalpoint_intervalpoint_intervalhpredict_curvepredict_curve_densitypredicted_drawspredicted_rvarspredicted_samplespstudent_tqiqlkjcorr_marginalqstudent_tr_dist_namerecover_typesresidual_drawsrlkjcorr_marginalrstudent_tsample_drawsscale_interval_alpha_continuousscale_interval_alpha_discretescale_interval_color_continuousscale_interval_color_discretescale_interval_colour_continuousscale_interval_colour_discretescale_interval_linetype_continuousscale_interval_linetype_discretescale_interval_size_continuousscale_interval_size_discretescale_point_alpha_continuousscale_point_alpha_discretescale_point_color_continuousscale_point_color_discretescale_point_colour_continuousscale_point_colour_discretescale_point_fill_continuousscale_point_fill_discretescale_point_size_continuousscale_point_size_discretescale_slab_alpha_continuousscale_slab_alpha_discretescale_slab_color_continuousscale_slab_color_discretescale_slab_colour_continuousscale_slab_colour_discretescale_slab_fill_continuousscale_slab_fill_discretescale_slab_linetype_continuousscale_slab_linetype_discretescale_slab_shape_continuousscale_slab_shape_discretescale_slab_size_continuousscale_slab_size_discretespread_drawsspread_rvarsspread_samplesstat_ccdfintervalstat_ccdfintervalhstat_cdfintervalstat_cdfintervalhstat_dist_ccdfintervalstat_dist_ccdfintervalhstat_dist_cdfintervalstat_dist_cdfintervalhstat_dist_dotsstat_dist_dotshstat_dist_dotsintervalstat_dist_dotsintervalhstat_dist_eyestat_dist_eyehstat_dist_gradientintervalstat_dist_gradientintervalhstat_dist_halfeyestat_dist_halfeyehstat_dist_intervalstat_dist_intervalhstat_dist_lineribbonstat_dist_pointintervalstat_dist_pointintervalhstat_dist_slabstat_dist_slabhstat_dist_slabintervalstat_dotsstat_dotshstat_dotsintervalstat_dotsintervalhstat_eyestat_eyehstat_gradientintervalstat_gradientintervalhstat_halfeyestat_halfeyehstat_histintervalstat_histintervalhstat_intervalstat_intervalhstat_lineribbonstat_pointintervalstat_pointintervalhstat_sample_slabintervalstat_slabstat_slabhstat_slabintervalStatDistSlabintervalStatIntervalStatPointintervalStatSampleSlabintervalStatSlabintervalsummarise_drawstheme_ggdisttheme_tidybayestidy_drawstidy_samplesto_broom_namesto_ggmcmc_namesungather_drawsungather_samplesunnest_rvarsunspread_drawsunspread_samplesx_at_y

Dependencies:abindarrayhelpersbackportscheckmateclicodacolorspacecpp11distributionaldplyrfansifarvergenericsggdistggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmatrixStatsmgcvmunsellnlmenumDerivpillarpkgconfigposteriorpurrrquadprogR6RColorBrewerRcpprlangscalesstringistringrsvUnittensorAtibbletidyrtidyselectutf8vctrsviridisLitewithr

Extracting and visualizing tidy draws from brms models

Rendered fromtidy-brms.Rmdusingknitr::rmarkdownon Oct 17 2024.

Last update: 2024-09-17
Started: 2017-11-16

Extracting and visualizing tidy draws from rstanarm models

Rendered fromtidy-rstanarm.Rmdusingknitr::rmarkdownon Oct 17 2024.

Last update: 2024-09-17
Started: 2017-03-12

Extracting and visualizing tidy residuals from Bayesian models

Rendered fromtidybayes-residuals.Rmdusingknitr::rmarkdownon Oct 17 2024.

Last update: 2024-09-17
Started: 2019-01-05

Using tidy data with Bayesian models

Rendered fromtidybayes.Rmdusingknitr::rmarkdownon Oct 17 2024.

Last update: 2024-09-17
Started: 2016-11-12

Using tidybayes with the posterior package

Rendered fromtidy-posterior.Rmdusingknitr::rmarkdownon Oct 17 2024.

Last update: 2024-09-17
Started: 2021-07-05

Readme and manuals

Help Manual

Help pageTopics
Tidy Data and 'Geoms' for Bayesian Modelstidybayes-package tidybayes
Add draws to a data frame in tidy formatadd_draws
Add draws from the posterior fit, predictions, or residuals of a model to a data frameadd_epred_draws add_linpred_draws add_predicted_draws add_residual_draws epred_draws epred_draws.brmsfit epred_draws.default epred_draws.stanreg linpred_draws linpred_draws.brmsfit linpred_draws.default linpred_draws.stanreg predicted_draws predicted_draws.brmsfit predicted_draws.default predicted_draws.stanreg residual_draws residual_draws.brmsfit residual_draws.default
Add 'rvar's for the linear predictor, posterior expectation, posterior predictive, or residuals of a model to a data frameadd_epred_rvars add_linpred_rvars add_predicted_rvars epred_rvars epred_rvars.brmsfit epred_rvars.default epred_rvars.stanreg linpred_rvars linpred_rvars.brmsfit linpred_rvars.default linpred_rvars.stanreg predicted_rvars predicted_rvars.brmsfit predicted_rvars.default predicted_rvars.stanreg
Combine the chain and iteration columns of tidy data frames of drawscombine_chains
Compare the value of draws of some variable from a Bayesian model for different levels of a factorcompare_levels
Compose data for input into a Bayesian modelcompose_data
Data lists for input into Bayesian modelsas_data_list as_data_list.character as_data_list.data.frame as_data_list.data_list as_data_list.default as_data_list.factor as_data_list.list as_data_list.logical as_data_list.numeric data_list
Density bins and histogram bins as data framesdensity_bins histogram_bins
Use emmeans contrast methods with compare_levelsemmeans_comparison
Extract draws of variables in a Bayesian model fit into a tidy data formatgather_draws spread_draws
Extract a tidy data frame of draws of posterior distributions of "estimated marginal means" (emmeans/lsmeans) from a Bayesian model fit.gather_emmeans_draws gather_emmeans_draws.default gather_emmeans_draws.emm_list
Gather pairwise combinations of values from key/value columns in a long-format data framegather_pairs
Extract draws from a Bayesian model into tidy data frames of random variablesgather_rvars spread_rvars
Gather variables from a tidy data frame of draws from variables into a single columngather_variables
Get the names of the variables in a fitted Bayesian modelget_variables get_variables.default get_variables.mcmc get_variables.mcmc.list
Prefix function generator for composing dimension index columnsn_prefix
Nest and unnest 'rvar' columns in data framesnest_rvars unnest_rvars
Deprecated: Prediction curves for arbitrary functions of posteriorspredict_curve predict_curve_density
Decorate a model fit or sample with data types recovered from the input dataapply_prototypes recover_types
Sample draws from a tidy-format data frame of drawssample_draws
Summaries of draws in 'grouped_df' objectssummarise_draws.grouped_df
Get a sample of posterior draws from a model as a tibbletidy_draws tidy_draws.brmsfit tidy_draws.CmdStanFit tidy_draws.CmdStanMCMC tidy_draws.data.frame tidy_draws.default tidy_draws.draws tidy_draws.jagsUI tidy_draws.matrix tidy_draws.mcmc.list tidy_draws.MCMCglmm tidy_draws.runjags tidy_draws.stanfit tidy_draws.stanreg
Deprecated functions, arguments, and column names in tidybayesadd_fitted_draws add_fitted_samples add_predicted_samples as_sample_data_frame as_sample_tibble extract_samples fitted_draws fitted_draws.default fitted_samples gather_emmeans_samples gather_lsmeans_samples gather_samples gather_terms GeomIntervalh GeomPointintervalh geom_dotsh geom_dotsintervalh geom_eye geom_eyeh geom_halfeyeh geom_intervalh geom_pointintervalh geom_slabh ggeye mean_hdcih mean_hdih mean_qih median_hdcih median_hdih median_qih mode_hdcih mode_hdih mode_qih parameters point_intervalh predicted_samples spread_samples stat_ccdfintervalh stat_cdfintervalh stat_dist_ccdfintervalh stat_dist_cdfintervalh stat_dist_dotsh stat_dist_dotsintervalh stat_dist_eyeh stat_dist_gradientintervalh stat_dist_halfeyeh stat_dist_intervalh stat_dist_pointintervalh stat_dist_slabh stat_dotsh stat_dotsintervalh stat_eyeh stat_gradientintervalh stat_halfeyeh stat_histintervalh stat_intervalh stat_pointintervalh stat_slabh tidybayes-deprecated tidy_samples ungather_samples unspread_samples
Models supported by tidybayestidybayes-models
Turn tidy data frames of variables from a Bayesian model back into untidy dataungather_draws unspread_draws
Generate lookup vectors for composing nested indicesx_at_y