Using the wiener_lpdf() function in the cmdstanr package to implement a diffusion model, the construction of a Markov chain was unsuccessful

Can you share the random seed used?

L1dat.RData (23.3 KB)
level1.stan (1.6 KB)
estimate1.R (1.4 KB)
I’ve uploaded the files related to my running code, and I’d be very grateful if you had time to take a look. I used set.seed(123) for the initial value setting, and the data was uploaded accordingly.
The following problems have arisen.
Chain 1
Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 2 Exception: wiener_lpdf: Inter-trial variability in A-priori bias = 1, but must be smaller than 2*(A-priori bias) = 0.9 (in ‘C:/Users/admin/AppData/Local/Temp/Rtmpo5eIZw/model-c8c3ab02c4.stan’, line 28, column 8 to column 73)
Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
Chain 2
Chain 2 Assertion failed: index >= 0 && index < size(), file stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/DenseCoeffsBase.h, line 410
Chain 2 finished unexpectedly!

Chain 3 Assertion failed: index >= 0 && index < size(), file stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/DenseCoeffsBase.h, line 410
Chain 3 finished unexpectedly!

Chain 1 Assertion failed: index >= 0 && index < size(), file stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/DenseCoeffsBase.h, line 410
Chain 1 finished unexpectedly!

Chain 4 Assertion failed: index >= 0 && index < size(), file stan/lib/stan_math/lib/eigen_3.4.0/Eigen/src/Core/DenseCoeffsBase.h, line 410
Chain 4 finished unexpectedly!

Use read_cmdstan_csv() to read the results of the failed chains.

1: All chains finished unexpectedly! Use the $output(chain_id) method for more information.

2: No chains finished successfully. Unable to retrieve the fit.

Thanks. That exact code succeeds at initializing for me locally. Granted, I am not using Windows, but I would be surprised if that was the issue.

The path your estimate1.R file mentions is different than one in your screenshot above (it is ~/Psychology/DDM/cmdstan/) – are you sure this is the one you intend to be using?

My other thought was that it seems like cmdstanr is putting stuff in a temp location:

Is it possible that this is leading to re-used models from older compilations you don’t intend?

Oh, thank you, is that the result of the inconsistent path? So what should I do to solve this problem?

I would check and see what version of cmdstan is living at that Psychology/DDM folder location, and replace it. Or, since the release is out, run cmdstanr’s install_cmdstan and don’t set a custom path

Thank you, but I don’t seem to put the path in #set_cmdstan_path(“~/Psychology/DDM/cmdstan/”) # set correspondingly here, my path is in this.
cmdstan_path()
[1] “C:/Users/admin/.cmdstan/cmdstan-2.35.0”

Could you try setting the force recompile option in cmdstanr?