Hi,

I’m new to brms and stan, so this might be a trivial question. I have been following Henrik Singmann’s tutorial for running the wiener model in brms. That worked, but I also wanted to run a model with intercepts. So I tried adapting my code based on the example from ‘Bayesian Item Response Modelling in R with brms and Stan’. Then I got an error that the initial values of ndt are set too high (i.e. higher than minimum RT), even though I try to initialize them close to zero ( list(temp_ndt_Intercept = -3) ). To try understand what was going on I ran the code from the paper (https://github.com/paul-buerkner/Bayesian-IRT-paper/blob/master/Bayesian-IRT.R), but that produced the same error:

Excerpt from error message:

Chain 4: Rejecting initial value:

Chain 4: Error evaluating the log probability at the initial value.

Chain 4: Exception: Exception: wiener_lpdf: Random variable = 0.965, but must be greater than nondecision time = 1.04238 (in ‘model7d973fd9c0af_d908d4e2cda6f9128dad49c464cdc6b9’ at line 18)

(in ‘model7d973fd9c0af_d908d4e2cda6f9128dad49c464cdc6b9’ at line 157)

Chain 4:

Chain 4: Initialization between (-0.05, 0.05) failed after 100 attempts.

Chain 4: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.

[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”

error occurred during calling the sampler; sampling not done

here are whatever error messages were returned

[[1]]

Stan model ‘d908d4e2cda6f9128dad49c464cdc6b9’ does not contain samples.

Code from paper:

library(tidyverse)

library(brms)

# set ggplot theme

theme_set(bayesplot::theme_default())

# set rstan options

rstan::rstan_options(auto_write = TRUE)

options(mc.cores = min(4, parallel::detectCores()))

data(“rotation”, package = “diffIRT”)

rotation <- rotation %>%

as_tibble() %>%

mutate(person = seq_len(n())) %>%

gather(“key”, “value”, -person) %>%

extract(“key”, into = c(“type”, “item”), regex = “(.)\[(.+)\]”) %>%

spread(“type”, “value”) %>%

rename(time = T, resp = X) %>%

mutate(

rotate = factor(case_when(

item %in% c(2, 5, 8) ~ 50,

item %in% c(3, 6, 10) ~ 100,

item %in% c(1, 4, 7, 9) ~ 150

)),

item = as.numeric(item)

)

# get an overview of the data

head(rotation, 10)

bform_drift1 <- bf(

time | dec(resp) ~ rotate + (1 |p| person) + (1 |i| item),

bs ~ rotate + (1 |p| person) + (1 |i| item),

ndt ~ rotate + (1 |p| person) + (1 |i| item),

bias = 0.5

)

# specify initial values to help the model start sampling

chains <- 4

inits_drift <- list(temp_ndt_Intercept = -3)

inits_drift <- replicate(chains, inits_drift, simplify = FALSE)

# fit the model

fit_drift1 <- brm(

bform_drift1, data = rotation,

family = brmsfamily(“wiener”, “log”, link_bs = “log”, link_ndt = “log”),

chains = chains, cores = chains,

inits = inits_drift, init_r = 0.05,

control = list(adapt_delta = 0.99)

)

# summarize the model

summary(fit_drift1)

- Operating System: macOS Catalina 10.15.2
- brms Version: 2.10.0