I have the fitted brms model below:
brms_example = brm(formula = prev_gpa ~ maternal_edu + gender + (1|race_eth) + (1|school),
prior = c(
prior(normal(0, .25), class=b),
prior(normal(2.7,.25), class=Intercept),
prior(normal(0, .25), class = sd),
prior(normal(0, .25), class = sigma)
),
data = dat,
chains = 1,
core = 1,
control = list(adapt_delta = 0.99)
)
The covariates in the dataset look like this:
> head(dat)
prev_gpa maternal_edu gender race_eth school
1 3.661914 0 1 5 11101
2 2.789677 1 0 2 01329
3 3.221341 0 1 4 10625
4 2.644177 0 1 3 07923
5 4.094903 1 0 3 10442
6 3.653299 1 1 2 06654
The dataset dat
used to fit brms_example
only has 68 unique schools. Suppose the school level 99978 is not in the sample dat
, and I want to do:
posterior_predict(brms_example, newdata = data.frame(maternal_edu=1,gender=1,race_eth=5,school="99978"), allow_new_levels=TRUE)
What does this actually return? My intuition says that
data.frame(maternal_edu=1,gender=1,race_eth=5,school="x")
is generated each time where x
is a sample from the 68 schools in dat
, then a sample from the posterior predictive distribution is taken for this new datapoint. This is repeated 1000 times.
- Operating System: 10.13.6
- brms Version: 2.12.0