I am having trouble understanding the documentation for rstanarm’s posterior prediction function.
newdataargument may include new levels of the grouping factors that were specified when the model was estimated, in which case the resulting posterior predictions marginalize over the relevant variables.
So if I have model like
library(rstanarm) data <- nlme::Machines m <- stan_glmer( score ~ Machine + (1 | Worker), data, family = gaussian, prior = normal(0, 1))
And generate predictions for a
Worker not in the dataset:
new_data <- data.frame(Worker = "FAKE", Machine = c("A", "B", "C")) sims <- posterior_predict(m, newdata = new_data)
Would these predictions be posterior simulations for a completely new worker? Or for a completely average worker?