Dear brms users,
For a psychological experiment, I have a mixed effect linear regression model with brms like…
model <- brm(DV ~ 1 + A + B + A:B + (1 + A + B + A:B | participant),…
Here, A is a categorical variable with two levels and B is a standardized continuous variable. I used effect coding for the categorical variable A (-1 and 1). This data frame recognises the effect coding variable as a continuous variable, not factor. Then, I wanna draw a figure with…
plot(conditional_effects(model, effects=“B:A”), points=TRUE)))
But the figure has three lines (with each 95%CRI) for A = -1, 1, and their mean 0, which are different colors. On the other hand, all plots are black. What I want is that the figure is depicted as A is referred as factor; coloring/grouping by levels of A for lines and plots.
So I tried…
g <- plot(conditional_effects(model, effects=“B:A”), points=TRUE)
g <- g + geom_points(aes(colour=factor(A)))
g
But not well-worked. Also I tried…
cond = data.frame(A = c(-1, 1))
plot(conditional_effects(model, conditions = cond, effects=“B:A”), points=TRUE)
But same two figures out alongside and they had no change from the original figure. Would someone tell me how to solve this?
I need keep this type of effect coding. Of course, the simplest way is that I look for a way to translate variable A to factorial variable with effect coding of -1 and +1 before estimation and re-estimate it (is there such way?). But I have many other model with the same problem and re-estimation need super long time. I don’t wanna do it.
My environment
- Operating System: MacOS Mojave 10.14.6
- brms Version: 2.13.5
- R Version: 3.6.3
- Rstudio Version: 1.3.1056
Thank you very much,
Yutani