Initial values for drift diffusion model with continuous predictor


I have been following Henrik Singmann’s great drift diffusion model tutorial (using brms):

It all works well with categorical predictors (x1:x2:x3, all x’s being categorical), e.g.

formula <- bf(RT | dec(Response) ~ 0 + x1:x2:x3 + (0 + x1:x3|p|SubjectID), 
               bs ~ 0 + x1:x2:x3 + (0 + x1:x3|p|SubjectID), 
               ndt ~  0 + x1:x2:x3,
               bias = 0.5)

However, if I have a numeric predictor (let’s assume linear for now), the model just cannot find valid initial values:

log(0) sampling errors (Log probability evaluates to log(0), i.e. negative infinity.)

I am probably overlooking something basic in how a continuous variable interacts with the x1:x2 notation and failing to account for that when defining initial values.

Here is our reproducible example:

  1. A sample dataset:
    The dataset is about a categorical perception task (discriminating between “Sendt” and “Tændt”), where the stimulus is along a graded continuum between the two extremes (Step codes for the position on the continuum). ResponseN is the response, RT_target is the RT. We have 2 additional binary categorical predictors (Language, indicating the native language of the participants; and Bias indicating which perception is supported by the context, a sentence in which the stimulus is situated).

  2. A R markdown with the code we used to set up formula, priors and initial values:


I don’t have time to look at the exact model and data right now, but possibly the scale of the continuous predictors is too large. Standardizing them might help.


thanks! The scale is 0-1, so that should not be an issue. I think what I’m missing is:
i) if we have a y ~ x1:x2 situation with categorical predictors (2 values for simplicity), we basically need 4 initial values.
ii) if we have y ~ x1:x2 situation with 1 categorical predictor and 1 continuous, I am not sure how the initial values structure should look like.


I often ask myself the same question. You can find out what model.matrix actually did by investigating the $X_<dpar> elements of the make_standata output.


Thanks! It took a while but by looking at this and trying out a wider range of initial values we managed to make it work.