This would give me a difference score between comp[incongruent] and comp[congruent], with a random effect on session, time, subject.
The problem is, I recently found out we have a positive correlation between age and RT, how can I control for that with BRMS? I am assuming it’s just adding ‘+ age’ as a predictor?
But where in the syntax?
m1 <- brm(
data = dat,
family = lognormal(),
bf(RT ~ 1 + age + comp + (1 + comp |c| session:time:subj_num),
sigma ~ 1 + age + comp + (1 + comp |c| session:time:subj_num)))
Note that I have added an intercept, because once you add a continuous predictor, if you have 0 as the intercept, then that forces the intercept to be zero, which is likely not what you want. You were also missing a plus sign between the population and group level effects in the formula. You could also include age as a varying slope, like this (1 + age + comp |c| session:time:subj_num), if you think that the effect of age on reaction time varies by each session, time, subject combination.
Also, just to make sure, your varying effects are for each unique combination of session, time, and subject. Is that what you mean to do? If you were looking for nested effects, then you would use a / between them.
Thank you, this confirms one of the solutions I had in mind.
Thank you for the rest of the tips too. I am not interested in the intercept, hence I changed it to 0, but I was not aware of the forces the intercept to be 0. The missing plusses were a type-o. And yes, I am only interested in the unique combination of my varying effects. Thank you again.