# NOT RUN {
library(bayestestR)
if (require("logspline")) {
prior <- distribution_normal(1000, mean = 0, sd = 1)
posterior <- distribution_normal(1000, mean = .5, sd = .3)
bayesfactor(posterior, prior = prior)
}
# }
# NOT RUN {
# rstanarm models
# ---------------
if (require("rstanarm")) {
model <- stan_lmer(extra ~ group + (1 | ID), data = sleep)
bayesfactor(model)
}
# }
# NOT RUN {
if (require("logspline")) {
# Frequentist models
# ---------------
m0 <- lm(extra ~ 1, data = sleep)
m1 <- lm(extra ~ group, data = sleep)
m2 <- lm(extra ~ group + ID, data = sleep)
comparison <- bayesfactor(m0, m1, m2)
comparison
bayesfactor(comparison)
}
# }
Run the code above in your browser using DataLab