Closed Ax3man closed 5 years ago
Thanks for the kind words :)
In this case, there are two approaches you could take to get the effects:
Combine the 0-centered parameters with whichever parameter(s) in the model give you the mean of the groups. That is the approach shown in the example in the section "Combining variables with different indices in a single tidy format data frame" in the tidy-brms vignette.
Use add_fitted_draws
to generate conditional means. This is the approach used in the "Posterior fits" section of the tidy-brms vignette, and generally speaking the approach I tend to use (it's usually simpler).
Both approaches should give the same result. For reference, both examples above are based on a model like response ~ (1|condition)
. For more complex models, I usually find approach 2 easier. The dataset and model are described at the top of the tidy-brms vignette.
Let me know if that helps.
Yeah I'm fitting a phylogenetic meta-analysis with moderators, so more something like yi | se(vi) ~ mod1 + mod2 + (1 | species) + (1 + mod1 + mod2 | group)
, where mod1
and mod2
are binary moderators.
I'm actually interested in plotting i) the estimates of mod1
and mod2
for each level of group
. I can get those values (and draws) from coef
.
And ii) the means of the levels of mod1
and mod2
each, while averaging over the levels of the other moderator. Indeed it looks like I can use add_fitted_draws
for that on the original data, and do a group_by
and summarise
to average over the other terms (the other moderator and species).
Thanks for your help!
My pleasure!
Hi,
Thanks for a very useful package, I'm using it to easily obtain draws from
brms
.As you probably know,
brms
reports the values for group-level effects ("random effects") centered around 0, not around the estimated intercept. This means that if I usegather_draws
to plot the posterior distributions for different levels of a group-level effect I don't actually see the estimated means of each level, but the estimated deviation from the intercept. (If I understand correctly.)This is also the difference between
as.data.frame(fit)
orcoef(fit)
.Can I get the values that
coef
reports fromtidybayes
? Doesgather_draws
need an argument to specify this?