Tidybayes Versions Save

Bayesian analysis + tidy data + geoms (R package)

v3.0.6

8 months ago

Deprecations:

  • Using recover_types() with character vectors is now deprecated, as the expected order of the levels of the variable is ambiguous, leading to hard-to-spot errors where indices and names do not line up correctly. A warning message has been added suggesting the use of factors instead. (#312)

Bug fixes:

  • Make test for residual_draws() more robust (due to change in default value of the method argument to brms::residuals()). (#313)

v3.0.4

11 months ago

Bug fixes:

  • Fix test for summarise_draws.grouped_df() due to changes in how posterior::summarise_draws() handles the num_args argument.

v3.0.3

1 year ago
  • Much improved documentation of the difference between epred, linpred, and predicted in add_XXX_rvars().
  • Fixes for compatibility with changes and deprecations in dplyr and tidyr.
  • Add note about argument name changes to fitted_draws() deprecation warning (#288).
  • More correct error message for epred_draws() on rethinking models.
  • Use posterior::as_draws_df() instead of As.mcmc.list() for rstan objects.

v3.0.2

2 years ago
  • Future-proof against changes coming in ggdist 3.1 (unification of stat_... and stat_dist_...)
  • Minor fixes for R 3.5/3.6 compatibility
  • Use @examplesIf for conditional examples (#294)
  • Warn when input names in compose_data() are overwritten by generated names (#295)

v3.0.1

2 years ago

Minor update for compatibility with brms 2.16.0.

v3.0.0

2 years ago

Breaking changes and deprecations:

  • The [add_]XXX_draws() (predicted_draws(), add_predicted_draws(), etc) functions have been substantially restructured:
    • add_fitted_draws() and fitted_draws() are now deprecated, along with the scale argument. Several years' teaching experience has demonstrated that "fitted" is a very confusing name for students. Use the more-specific [add_]linpred_draws() if you want draws from the linear predictor or the new [add_]epred_draws() if you want draws from the expectation of the posterior predictive (which is what fitted_draws() was most typically used for).
    • Arguments for renaming output columns are now all called value, but retain function-specific default column names. E.g. the prediction argument for predicted_draws() is now spelled value but has a default of ".prediction". One breaking change is that the default output column for linpred_draws() is now ".linpred" instead of ".value". This should make it easier to combine outputs across multiple functions while also making it easier to remember the name of the argument that changes the output column name.
    • The n argument is now spelled ndraws to be more consistent with terminology in the posterior package and to prevent partial argument name matching bugs with newdata.
    • The first argument to all of these functions is now object instead of model, in order to match with argument names in posterior_predict(), etc. This was necessary to prevent partial argument name matching bugs with certain model types in rstanarm that have an m argument to their prediction functions.

New features:

  • Support for the new posterior package:
    • Several new _rvars counterparts to the _draws family of functions, including spread_rvars(), gather_rvars(), epred_rvars(), linpred_rvars(), and predicted_rvars(), which add columns of posterior::rvar() objects to data frames instead of long-format columns of draws. These can be easier to read and take up less memory than the long-format data frames of draws. See vignette("tidy-posterior") for examples.
    • The nest_rvars() and unnest_rvars() functions for converting between data frames of rvars and long format data frames of draws.
    • tidy_draws() has been rebuilt on top of posterior::as_draws_df(), which means it should support even more model types and benefit from efficiency improvements in posterior. This means that cmdstanr is now supported, for example.
    • An implementation of posterior::summarise_draws() for grouped data frames of draws: summarise_draws.grouped_df()
    • compare_levels() now supports data frames of posterior::rvar()s.
  • The epred_draws(), linpred_draws(), and predicted_draws() functions should now support any models that implement posterior_epred(), posterior_linpred(), and posterior_predict() so long as they take a newdata argument.
  • Several dependencies have been removed or demoted to Suggests, including forcats, plyr, and purrr.
  • Added the option to set the seed when subsampling to several functions (#276).

New documentation:

  • vignette("tidy-posterior") describing the use of tidybayes with posterior, and particularly the posterior::rvar() data type. This vignette also includes an updated version of the ordinal regression example from vignette("tidy-brms"), now with an illustration of the relationship between the latent linear predictor and the category-level probabilities.

Bug fixes:

  • Omit sampler parameters in tidy_draws() if retrieving them results in an error (#244)

v2.3.1

3 years ago
  • Allow user-specified names for comparisons in compare_levels() (#272)
  • Allow contrasts from the emmeans package to be used with compare_levels() via the new emmeans_comparison() function (#272)

v2.1.1

3 years ago
  • Initial split of tidybayes into tidybayes and ggdist (#250). ggdist now contains all stats/geoms from tidybayes (except deprecated ones), all support functions for stats/geoms (such as point_interval()), vignette("slabinterval"), and vignette("freq-uncertainty-vis"). tidybayes retains all other functions, and re-exports all ggdist functions for now.
  • All stats and geoms now support automatic orientation detection (#257), following the new automatic orientation detection approach in ggplot2. If needed, this can be overridden using the existing orientation parameter.
    • All h-suffix geoms are now deprecated. The h-suffix geoms have been left in tidybayes and give a deprecation warning when used; they cannot be used from ggdist directly.
    • The h-suffix point_interval() functions are also deprecated, since they are not needed in tidybayes nor in ggplot2::stat_summary().
    • geom_interval(), geom_pointinterval(), and geom_lineribbon() no longer automatically set the ymin and ymax aesthetics if .lower or .upper are present in the data. This allows them to work better with automatic orientation detection (and was a bad feature to have existed in the first place anyway). The deprecated tidybayes::geom_intervalh() and tidybayes::geom_pointintervalh() still automatically set those aesthetics, since they are deprecated anyway (so supporting the old behavior is fine in these functions).
  • geom_lineribbon()/stat_lineribbon() now supports a step argument for creating stepped lineribbons (#249). H/T to Solomon Kurz for the suggestion.
  • ggdist now has its own implementation of the scaled and shifted Student's t distribution (dstudent_t(), qstudent_t(), etc), since it is very useful for visualizing confidence distributions. That is re-exported in tidybayes as well`.
  • All deprecated functions and geoms now throw deprecation warnings (previously, several deprecated functions did not).

v2.0.3

4 years ago

Minor fixes for changes in tibble 3.0.0

v2.0.2

4 years ago

Various minor forward and backward compatibility fixes:

  • Fix stringsAsFactors issues for R 4
  • Fix issues with [[<- for R 4
  • Fix minor issues with dplyr 1.0.0
  • Use parse() instead of str2lang() for compatibility with R <= 3.6