This may be a dumb question, but here it goes.
Let’s say I have a model like this: fit<-brm(outcome ~ time + (time|state/county/town))
If I run conditional_effects(fit, re_formula=NA), then the uncertainty in the group-level effects is not included. So does that mean they are set to zero (ie a value of zero offset from the population level intercept and slope)? If I run conditional_effects(fit, re_formula=~(1+time|state)), then the uncertainty in the state level effect is included but not the county and town. So are county and town set to zero?
I tried looking at the dataframe from which the conditional_effects call was plotting, but it just said “NA” for any group level effects in the dataframe.
I also saw this comment by @bgoodri that mentioned that a group left out of the re_formula was “integrated over”.
Could someone shed some light on this? When I call conditional_effects(fit, re_formula=~(1+time|state)) in my above example am I conditioning on state but integrate over county/town? Or is county/town set to zero (zero offset from the state level)? Or neither?
What is the difference between integrating over and setting to zero?
I am a bit confused.
Here @paul.buerkner says that setting re_formula=NA sets the group level effects to zero. So it seems in my example above, specifying re_formula=~(1+time|state) would set county/town effects to zero but include the uncertainty in state.
So, I don’t understand @bgoodri comment linked above about integrating over the random effect left out of the re_formula() call.
The reason I would like to clarify this, is that I am working on an analysis where I would particularly like to show that much of the variation in my outcome is seen in the hierarchical group level effects. A good way to demonstrate this is by a series of conditional_effects() plots showing the trend over time when the uncertainty for time|state, time|state/county, and time|state/county/town is included for each plot (the plots show increasing uncertainty for the trend over time as the effects are included).
I would like to get the figure legend correctly written for those plots.
Any insight is appreciated. Thanks!
When using re_formula = NA or leaving out certain groups, we indeed set them to zero (that is, condition on a level with average parameter values) and don’t integrate over them. The latter will eventually be possible as well but is not yet supported.
Thanks so much for the clarification @paul.buerkner !
What is the practical difference between setting them to zero and integrating over them? I have been reading this article to try to understand (particularly the R code in the supplement). If someone has a brief practical explanation, that would be helpful.
When you use non-linear transformations, the difference matters. For example:
mean(exp(rnorm(1000, 0, 1)))
Both have the same mean before transformation (i.e. before exp()) but because of the non-linearity, the mean after transformation is different.
Ahh ok, thanks @paul.buerkner !! I think I understand - so when one “integrates over the random effects”, then one is averaging over the random effects on the outcome scale (transform and then average over; like make predictions across the distribution of random effects and then average over all of these predictions); which is quite different than taking the average value of the random effects (zero), conditioning on that value, and then making predictions. Correct?
Yeah, that sounds correct to me.
Thanks again for all of your help! Your responses cleared up all of the questions that I had in this post.
Also, I love the brms package. Really an amazing tool. Thanks