I hope this is on topic, if not please let me know I’ll delete the post.
Also a disclaimer: I already posted the same question on stats.stackexchange but did not get any answers (if this is not ok to cross-post also please let me know I’ll delete it)
I fit a model in brms like this:
brm(rt ~ c * d +
(1 + c * d | subj) +
(1 + c * d | item),
family = lognormal(),
prior = priors,
iter = 4000)
So the model is really:
where:
- y is a variable measured in ms
- c is a sum-contrast coded variable equal to 1 or -1.
- d is a scaled and centered continuous variable
I have trouble with backtransforming the estimates into the ms scale.
I think I know how to do this for c:
For interaction this is slightly more complicated. Let the interaction effect be:
IE = \frac{\partial \mu}{\partial d}|_{c = 1} - \frac{\partial \mu}{\partial d}|_{c = -1}. I remove the log by exponentiation and then I take the derivative which results in:
So the interaction effect is the difference of these two terms:
Are these derivations correct?
If yes, this means that these effects are functions of d, but fitting the model returns the effects (on the log scale) as constants. Could someone explain or point me to a resource to understand where does this difference come from?
Another question I have is how to derive and interpret the effect for d? Ie. what are the meaningful points at which to evaluate the function \mu? Or maybe is there a better way of doing this?
If you think it’s easier to do in rstan (maybe in the generated quantities?) I’m fine with converting this to stan.