Stan_glmer() + posterior_predict() question

I am having trouble understanding the documentation for rstanarm’s posterior prediction function.

The newdata argument 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?

1 Like

Prediction for a worker (across these 3 machines) who is drawn from the same population as the previous 6 workers.

2 Likes