These functions translate tidybayes-style tidy data frames of draws to/from different tidy data frame formats (each format using a different naming scheme).

to_broom_names(data)

from_broom_names(data)

to_ggmcmc_names(data)

from_ggmcmc_names(data)

Arguments

data

A data frame to translate.

Value

A data frame with (possibly) new names in some columns, according to the translation scheme above.

Details

Function prefixed with to_ translate from the tidybayes format to another format, functions prefixed with from_ translate from that format back to the tidybayes format. Formats include:

to_broom_names() / from_broom_names():

  • .variable <-> term

  • .value <-> estimate

  • .prediction <-> .fitted

  • .lower <-> conf.low

  • .upper <-> conf.high

to_ggmcmc_names() / from_ggmcmc_names():

  • .chain <-> Chain

  • .iteration <-> Iteration

  • .variable <-> Parameter

  • .value <-> value

Examples

library(magrittr) data(line, package = "coda") line %>% gather_draws(alpha, beta, sigma) %>% median_qi() %>% to_broom_names()
#> # A tibble: 3 x 7 #> term estimate conf.low conf.high .width .point .interval #> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 alpha 3.02 1.97 3.88 0.95 median qi #> 2 beta 0.796 0.143 1.47 0.95 median qi #> 3 sigma 0.791 0.425 2.56 0.95 median qi