I’m handling the model with group-level effects. When I extract these effects using ranef (), I could see the estimate and their variation of each year. But I wonder which estimate is valuable to discuss. For example, when I checked the mean posterior distributions of Rocky_coast, it has an effect based on 95 % intervals. Then I checked their estimate and their variation for each species, the estimates of all the year crossed over zero value. How should I interpret these results?
If I understand their relation correctly, while brms::coef()
yields the posterior for a given effect in each species, accounting for both the overall/across-species effect of the variable as well as each species deviation from this overall effect, brms::ranef()
yields only the latter quantity (i.e. the magnitude/sign of each species deviation from the overall effect). For predictive purposes, you probably want brms::coef()
.
Thank you for the comments. I checked coef() and visualized them as you suggested, the results were still similar situation as ranef().
I tried to plot the posterior distribution of group-level effects like below, the estimates about Rocky_coast (for example) of all the year crossed over zero value although the mean posterior distribution seemed to be effective based on 95 % intervals.
bmodel<-readRDS("E:/model/test.rds")
model1tranformed <- ggs(bmodel)
years <- c("2007","2008","2009","2010","2011")
for (i in 1:length(exvars)){
pg<-ggplot(filter(model1tranformed, Parameter == paste("r_Year", "[", years[1],",",exvars[i],"]", sep = "")),
aes(x = value))+
geom_density(fill = "darkgreen",
alpha = .5)+
geom_vline(xintercept = 0,
col = "darkred",
size = 1)+
scale_x_continuous(name = "Value") +
geom_vline(xintercept = unlist(posterior_summary(bmodel)[paste("r_Year", "[", years[1],",",exvars[i],"]", sep = ""),3:4]),
col = "blue",
linetype = 2) +
theme_light() +
theme(text = element_text(size = 16))+
labs(title = paste("pd_",exvars[i]))
plots[[i]] = pg
}
ggpubr::ggarrange(plotlist=plots,
ncol = 5, nrow = 3)
the figure represented the result of 2007 year, and for the other years, the posterior distributions (95 % intervals; blue lines) crossed over zero (red line).