Here is my model fit through brms:
fm <- brm(Value | se(SE) ~ time:class + (time|subj) + (1|subj:class), data=dd)
I’d like to plot the slope effect of ‘time’ with the 90% quantile band for each level of factor ‘class’ in a panel layout. Below is my starting code:
require(tidyr) library(dplyr) library(modelr) library(tidybayes) dd %>% group_by(class) %>% data_grid(time = seq_range(time n = 101)) %>% add_predicted_draws(fm) %>% ggplot(aes(x = time, y = Value, color = ordered(class), fill = ordered(class))) + stat_lineribbon(aes(y = .prediction), .width = c(.95, .5, .05), alpha = 1/4) + geom_point(data = dd)
It failed with the following error:
Error in get(sgroup, data) : object 'subj' not found
How to fix this?