I’m trying to use pp_check by group. It might be related to this:
Given this data:
df_pupil_data <- structure(list(trial = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41), load = c(2,
1, 5, 4, 0, 3, 0, 4, 2, 3, 5, 1, 4, 3, 0, 1, 2, 5, 1, 5, 2, 3,
0, 4, 2, 1, 3, 0, 5, 4, 5, 1, 2, 3, 4, 0, 3, 4, 1, 2, 0), p_size = c(1021,
951, 1064, 913, 603, 826, 464, 758, 733, 591, 879, 851, 772,
829, 455, 588, 713, 708, 708, 787, 567, 722, 540, 667, 698, 653,
576, 626, 573, 726, 752, 727, 625, 683, 687, 636, 614, 655, 557,
645, 601), c_load = c(0, -1, 3, 2, -2, 1, -2, 2, 0, 1, 3, -1,
2, 1, -2, -1, 0, 3, -1, 3, 0, 1, -2, 2, 0, -1, 1, -2, 3, 2, 3,
-1, 0, 1, 2, -2, 1, 2, -1, 0, -2)), row.names = c(NA, -41L), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"))
And this model:
fit_pupil <- brm(p_size ~ c_load,
data = df_pupil_data,
family = gaussian(),
prior = c(
prior(normal(800, 300), class = Intercept),
prior(normal(0, 1000), class = sigma),
prior(normal(0, 100), class = b)
))
I want to plot posterior predict distributions by load
.
I could do it with bayesplot:
yrep <- posterior_predict(fit_pupil, nsamples = 1000)
y <- df_pupil_data$p_size
ppc_violin_grouped(y, yrep, group= df_pupil_data$load, probs = c(.1,.9), alpha = 0.1, y_draw = "points", y_size = 1.5)
But I couldn’t in brms, all these didn’t work
pp_check(fit_pupil, nsamples = 100, type = "violin_grouped", group = "c_load")
pp_check(fit_pupil, nsamples = 100, type = "violin_grouped", group = "load")
pp_check(fit_pupil, nsamples = 100, type = "violin_grouped", group = "factor(c_load)")
pp_check(fit_pupil, nsamples = 100, type = "violin_grouped", group = "df_pupil_data$c_load")
pp_check(fit_pupil, nsamples = 100, type = "violin_grouped", group = df_pupil_data$c_load)
Please also provide the following information in addition to your question:
- Operating System: Ubuntu 18.04.1
- brms Version: 1.10