# NOT RUN {
library(bayestestR)
prior <- distribution_normal(1000, mean = 0, sd = 1)
posterior <- distribution_normal(1000, mean = .5, sd = .3)
si(posterior, prior)
# }
# NOT RUN {
# rstanarm models
# ---------------
library(rstanarm)
contrasts(sleep$group) <- contr.bayes # see vingette
stan_model <- stan_lmer(extra ~ group + (1 | ID), data = sleep)
si(stan_model)
si(stan_model, BF = 3)
# emmGrid objects
# ---------------
library(emmeans)
group_diff <- pairs(emmeans(stan_model, ~group))
si(group_diff, prior = stan_model)
# brms models
# -----------
library(brms)
contrasts(sleep$group) <- contr.bayes # see vingette
my_custom_priors <-
set_prior("student_t(3, 0, 1)", class = "b") +
set_prior("student_t(3, 0, 1)", class = "sd", group = "ID")
brms_model <- brm(extra ~ group + (1 | ID),
data = sleep,
prior = my_custom_priors
)
si(brms_model)
# }
Run the code above in your browser using DataLab