Shifted lognormal initials with brms

Dear Stan/brms community :)

It’s been awhile that I am struggling to fit a model with shifted lognormal link-function for my response time data, and it is (mostly) doesn’t converged well.

I tried to mix tips from here , here (plus some other sources) and ended up with this model:

library(brms)
library(tidyverse)


Data <- Data %>%
  mutate(Type = as.factor(Type), # 4 levels var. within-subject
         Group = as.factor(Group), # 2 levels var. between-subject
         Control = as.factor(Control), # 2 levels var. between-subject
  ) %>%
  filter(Target.RT>100)

prior <- c(prior("normal(0,50)", class = "b"),
           prior("normal(0,50)", dpar = "ndt"),
           prior("cauchy(0,1)", dpar = "sigma"),
           prior("cauchy(0,1)", class = "sd"))

chains <- 3
inits_drift <- list(temp_ndt_Intercept = -3)
inits_drift <- replicate(chains, inits_drift, simplify = FALSE)

Model <- brm(
  data= Data,
  formula = bf(
    Target.RT | trunc(ub = 2000)~ Type*Group*Control+
      (Type|Subject),
    sigma~Type*Group*Control+
      (Type|Subject),
    ndt~Type*Group*Control+
      (Type|Subject)),
  family = shifted_lognormal(),
  iter = 1000,
  warmup = 500,
  prior = prior,
  inits = inits_drift,
  init_r = 0.2,
  chains = 6,
  cores  = 6,
  control = list(adapt_delta = 0.95,
                 max_treedepth = 12),
  save_pars = save_pars(all = TRUE)
)

The model converges without errors and with 79 divergent transitions after warmup, but it doesn’t converge well.

On the one hand, bases on the posterior predictive check, the function seems to fit :
PPcheckPlot

The chains on the other hand are messy:


Using more or less iterations and warmup did very little change, and the same for using the default priors.

I’d appreciate your help :)

1 Like

You might tighten up the prior on the NDT.

1 Like