I’m trying to calculate it myself, but can’t find anything that comes close.
@andrewheiss 's write up has this for epred:
epred_manual <- model_normal |>
spread_draws(b_Intercept, b_flipper_length_mm, sigma) |>
mutate(mu = b_Intercept +
(b_flipper_length_mm *
penguins_avg_flipper$flipper_length_mm), # This is posterior_linpred()
y_new = rnorm(n(), mean = mu, sd = sigma)) # This is posterior_predict()
# This is posterior_epred()
epred_manual |>
summarize(epred = mean(y_new))
Calling mean
averages over the draws, so there is a only single estimate/draw rather than draws of ndraws()
per row.
What does brms
do to get multiple epreds per observation?
This post:
Suggests posterior_epred()
would be mu
for a Student model.