brms offers a practical tool to implement most of the solutions proposed to model reaction times (RT), which helps pushing the research forward, as these types of models were until now fairly complicated to implement.
However, the body of literature on RT modelling, including Jonas’ famous RT post and other papers (Matzke, D., & Wagenmakers, E. J., 2009 or Anders, R., Alario, F., & Van Maanen, L., 2016) mentions the Shifted Wald (i.e., shifted Inverse Gaussian) models.
As I couldn’t find this distribution in brmsfamily, I was wondering if it was complicated to add as a custom family - since the non-shifted inverse.gaussian
already exists in base R? And if any guides for that were already existing?
1 Like
Hi,
so shifted distributions require some special consideration, but I hope you will find my blog on adding a mixture of uniform and shifted lognormal as a custom distribution helpful:
https://www.martinmodrak.cz/2021/04/01/using-brms-to-model-reaction-times-contaminated-with-errors/
Implementation in base R unfortunately does not help implementing a distribution in Stan and inverse gaussian is not AFAIK implemented natively in Stan. However brms
already has an implementation of inverse gaussian in Stan code which you can build upon. You can see the code by running:
brms::make_stancode(y ~1, family = "inverse.gaussian", data = data.frame(y = rinv_gaussian(10)))
Feel free to ask for any further clarifications or feedback!
1 Like