I was wondering how to obtain the posterior prediction based on a grouping variable from stan_glm()
?
For example, if I have a binary (0, 1)
coded grouping variable called "vs"
in my data, how can I obtain the prediction for vs == 0
and vs == 1
?
Here is my R
code:
fit <- stan_glm(mpg ~ ., data = mtcars)
posterior_predict(fit, newdata = ??)