Hi, I am new to brms and looking to learn about how the trunc specification works for the response variable. I have reaction time data in the range of 0 to 500 ms and I want to specify that. How can i specify that with the trunc function given I am using a lognormal family?
fit3 <- brm(reaction_time | trunc(ub = 500) ~ 1 + bigram + (1 + bigram| participant_id) ,
data = experiment_df ,
family = "lognormal",
prior = c(set_prior("lognormal(6,1)",class = "Intercept"),
set_prior("normal(0,2)", class = "b", coef = "bigram"),
set_prior("gamma(1,1)", class = "sigma")),
control = list(adapt_delta = 0.95))
I am not sure I understand your concern - the code you show seems (without me actually trying to run it) as a perfectly good way to specify the model - the lower bound of zero is implied by the lognormal family and you give the upper bound IMHO correctly.
Note however that there are three possible reasons for having data in the range 0 to 500 which all need different handling:
- Truncation (via
trunc) represents a process where responses out of the bounds are discarded (not observed at all), e.g. when you a detector with a certain range where it is sensitive.
- Censoring (via
cens) represents a process where responses out of bounds are observed, but we don’t know their exact values, only that they were out of bounds - this sounds a bit more likely for reaction times if you stop measuring after 500ms and can expect that the reaction could have occurred at some point, but it was longer than 500ms.
- Values just happened to all fall into this interval, without any a priori reason to fall there (such as the design considerations for censoring or truncating). In such cases it is usually better to not use censoring or truncation at all.
Best of luck with your model!
Thanks for your reply
To clarify: I was considering whether I should make the upper bound be log(500) so I was wondering whether the upper bound is truncating the transformed reponse or not.
Oh, that makes sense. Truncation is performed on the response scale, so you want to truncate at
500 not on