# NOT RUN {
library(bayestestR)
posterior <- rnorm(1000)
ci(posterior, method = "ETI")
ci(posterior, method = "HDI")
df <- data.frame(replicate(4, rnorm(100)))
ci(df, method = "ETI", ci = c(.80, .89, .95))
ci(df, method = "HDI", ci = c(.80, .89, .95))
# }
# NOT RUN {
if (require("rstanarm")) {
model <- stan_glm(mpg ~ wt, data = mtcars, chains = 2, iter = 200, refresh = 0)
ci(model, method = "ETI", ci = c(.80, .89))
ci(model, method = "HDI", ci = c(.80, .89))
ci(model, method = "SI")
}
if (require("brms")) {
model <- brms::brm(mpg ~ wt + cyl, data = mtcars)
ci(model, method = "ETI")
ci(model, method = "HDI")
ci(model, method = "SI")
}
if (require("BayesFactor")) {
bf <- ttestBF(x = rnorm(100, 1, 1))
ci(bf, method = "ETI")
ci(bf, method = "HDI")
}
if (require("emmeans")) {
model <- emtrends(model, ~1, "wt")
ci(model, method = "ETI")
ci(model, method = "HDI")
ci(model, method = "SI")
}
# }
Run the code above in your browser using DataLab