I’m new to Bayes and
brms. Apologize if this question has been asked before (a brief search did not help). I’m following the radon examples in Gelman and Hill (2007).
Suppose I fit a multilevel model in
library(brms) f1 <- brm(log_radon ~ floor + (1 | county), data = radon, family = "gaussian")
I want to plot the predictions by county for each level of floor (fig 12.4 p.257 of Gelman and Hill). I suppose one way is:
radon_yhats <- radon %>% mutate(log_radon_multilev = predict(f1, radon)) library(ggplot2) ggplot(data = radon_yhats, aes(y = log_radon, x = floor)) + geom_jitter() + geom_line(aes(x = floor, y = log_radon_multilev)) + facet_wrap(vars(county))
However, elsewhere I’ve seen references to
tidybayes::add_epred_draws()or sometimes people use
I guess I’m a bit confused about the difference between these approaches. For instance, is
tidybayes::add_epred_draws() the same as
predict()? What would be tidy-esque approach to plotting this figure?