I am simulating data according to a logshifted distribution in order to test my model before running it on real data.
As expected, the shifted lognormal family in brms only accepts positive values, in other words, the shift can only be positive.
However, the brms::rshifted_lnorm distribution can also generate negative values.
e.g. if I take estimated parameter values from a previous paper on reaction times and input them into the function:
I can get the kind of values I want by manually building a shifted lognormal:
exp(rnorm(1, mean = 0.14, sd = 0.7) - 0.85)
But I am wondering as to whether the inner workings of the shifted lognormal distribution in brms differ from this hand-coded solution (and therefore assessing parameter recovery would be useless, given the mismatch in the formula).
As @stijn suggests, a shifted lognormal is a lognormal that has been shifted, not a distribution whose logarithm is distributed as a shifted normal (which is again a normal; therefore this distribution is just a lognormal). If you want to see the inner workings of brms::rshifted_lnorm, these are just:
You are both absolutely right. This was a silly mistake on my part.
My misunderstanding was due to the shift (ndt) parameter in brms being on a log scale, as far as I can see.
So, I used (all positive) empirical data (reaction times) to fit a model, and extracted the parameter values, which were inputed in my simulation. Shift/ndt was -0.85, which would - I guess - be a reasonable 400 ms of non-decision-time, but directly feeding it into rshifted_lnorm() made it generate a consistent chunk of negative values.
So I’m a bit baffled as to how to properly input brms output of the shifted_lognormal() into rshifted_lnorm(). Is it by simply exponentiating the shift parameter?
So you’re absolutely right that ndt is estimated by default on a log scale, which is useful when interpreting as a non-decision-time because it will never be estimated to be negative. If your domain knowledge is consistent with the possibility of negative shifts, then this obviously doesn’t work, but you can get around that if desired using shifted_lognormal(link_ndt = "identity"). This would yield a parameter that is directly interpretable as the shift.
As you say, the way to generate values from the shifted lognormal when estimating the ndt using a log link is to exponentiate the linear predictor. This isn’t specific to the shifted lognormal: in GLMs we always need to feed the response distribution the inverse-link of the linear predictor.