tidybayes 3.0.0
Breaking changes and deprecations:
- The
[add_]XXX_draws()
(predicted_draws()
,add_predicted_draws()
, etc)
functions have been substantially restructured:add_fitted_draws()
andfitted_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 whatfitted_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. theprediction
argument
forpredicted_draws()
is now spelledvalue
but has a default of".prediction"
.
One breaking change is that the default output column forlinpred_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 spelledndraws
to be more consistent with
terminology in theposterior
package and to prevent partial argument
name matching bugs withnewdata
. - The first argument to all of these functions is now
object
instead of
model
, in order to match with argument names inposterior_predict()
, etc.
This was necessary to prevent partial argument name matching bugs with
certain model types inrstanarm
that have anm
argument to their
prediction functions.
New features:
- Support for the new
posterior
package:- Several new
_rvars
counterparts to the_draws
family of functions,
includingspread_rvars()
,gather_rvars()
,epred_rvars()
,linpred_rvars()
,
andpredicted_rvars()
, which add columns ofposterior::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. Seevignette("tidy-posterior")
for examples. - The
nest_rvars()
andunnest_rvars()
functions for converting between
data frames ofrvar
s and long format data frames of draws. tidy_draws()
has been rebuilt on top ofposterior::as_draws_df()
, which
means it should support even more model types and benefit from efficiency
improvements inposterior
. This means thatcmdstanr
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 ofposterior::rvar()
s.
- Several new
- The
epred_draws()
,linpred_draws()
, andpredicted_draws()
functions should
now support any models that implementposterior_epred()
,posterior_linpred()
,
andposterior_predict()
so long as they take anewdata
argument. - Several dependencies have been removed or demoted to Suggests, including
forcats
,plyr
, andpurrr
. - Added the option to set the
seed
when subsampling to several functions (#276).
New documentation:
vignette("tidy-posterior")
describing the use oftidybayes
withposterior
,
and particularly theposterior::rvar()
data type. This vignette also includes
an updated version of the ordinal regression example fromvignette("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)