Description Usage Arguments Details Value Examples
Visualise Bayesian marginal means and AMCEs
1 2 | cjbae_plot(data, visual = c("ridge", "halfeye", "point interval"),
estimate = c("amce", "mm"))
|
data |
A tidy dataframe of either AMCEs or MMs. |
visual |
Currently either "ridge" or "halfeye" - two different takes on a distribution plot. ADDED "point interval" which uses 'stat_pointintervalh()' from 'tidybayes'.' |
estimate |
Either "mm" or "amce". |
cjbae_plot()
plots AMCEs or marginal means of feature-levels as distributions, colour-coded by feature.
A plot of parameter distributions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #' #load example dataset from {cregg} (Leeper 2019)
library(cregg)
data(taxes)
# formula
f <- chose_plan ~ taxrate1 + taxrate2 + taxrate3 + taxrate4 + taxrate5 + taxrate6 + taxrev
# prior - minimally informative
prior <- c(set_prior("normal(0, .2)", class = "Intercept"),
set_prior("normal(0, .2)", class = "b"),
set_prior("exponential(10)", class = "sd"),
set_prior("exponential(10)", class = "sigma"))
# run amce function with save specified, saves brmsfit to working directory - this will take a while
amce_bae(data = taxes, formula = f, id = ID, prior = prior, save_amce = TRUE)
# run mm function on the saved output
readRDS(baerms)
mm <- mm_bae(baerms, f, ID)
# plot MMs
cjbae_plot(mm, "ridge", "mm")
# generate df of AMCEs
amce <- cjbae_df(baerms)
# plot AMCEs
cjbae_plot(amce, "halfeye", "amce")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.