Question in brief: I get an error when I set ‘sample_prior’ to ‘yes’ or TRUE when trying to sample from a model based on this formula and these priors:

tmp.bf <- bf(RT ~ 1,

theta2 ~ cond * group,

family = mixture(brmsfamily(‘gamma’, link = ‘log’, link_shape = ‘log’),

brmsfamily(‘gamma’, link = ‘log’, link_shape = ‘log’),

order = TRUE))tmp.priors <- set_prior(‘logistic(-3, 0.35)’, class = ‘Intercept’, dpar = ‘theta2’) +

set_prior(‘normal(-0.25, 0.5)’, class = ‘Intercept’, dpar = ‘mu1’) +

set_prior(‘normal(0.8, 0.5)’, class = ‘Intercept’, dpar = ‘mu2’) +

set_prior(‘gamma(9,3.5)’, class = ‘shape1’) +

set_prior(‘gamma(2.25, 1.25)’, class = ‘shape2’) +

set_prior(‘logistic(0, 0.1)’, class = ‘b’, dpar = ‘theta2’)bmt <- brm(tmp.bf, data = mydata, sample_prior = ‘yes’, prior = tmp.priors)

The error is this:

SYNTAX ERROR, MESSAGE(S) FROM PARSER:

Variable definition base type mismatch, variable declared as base type vector variable definition has

base type realVariable definition dimensions mismatch, definition specifies 1, declaration specifies 0

error in ‘model53682ca521fe_file536814f21ac0’ at line 87, column 56

`85: real prior_Intercept_mu2 = normal_rng(0.8,0.5); 86: real prior_shape2 = gamma_rng(2.25,1.25); 87: vector[Kc_theta2] prior_b_theta2 = logistic_rng(0,0.1); ^ 88: real prior_Intercept_theta2 = logistic_rng(-3,0.35);`

Error in stanc(model_code = paste(program, collapse = “\n”), model_name = model_cppname, :

failed to parse Stan model ‘file536814f21ac0’ due to the above error.SYNTAX ERROR, MESSAGE(S) FROM PARSER:

Variable definition base type mismatch, variable declared as base type vector variable definition has

base type realVariable definition dimensions mismatch, definition specifies 1, declaration specifies 0

error in ‘model5368692d6f86_file536814f21ac0’ at line 87, column 56

`85: real prior_Intercept_mu2 = normal_rng(0.8,0.5); 86: real prior_shape2 = gamma_rng(2.25,1.25); 87: vector[Kc_theta2] prior_b_theta2 = logistic_rng(0,0.1); ^ 88: real prior_Intercept_theta2 = logistic_rng(-3,0.35);`

Error in stanc(model_code = paste(program, collapse = “\n”), model_name = model_cppname, :

failed to parse Stan model ‘file536814f21ac0’ due to the above error.

I’ve tried different kinds of priors for the b_theta2 effects but I always get essentially the same error. Without a prior on those effects, i.e. :

test.priors <- set_prior(‘logistic(-3, 0.35)’, class = ‘Intercept’, dpar = ‘theta2’) +

set_prior(‘normal(-0.25, 0.5)’, class = ‘Intercept’, dpar = ‘mu1’) +

set_prior(‘normal(0.8, 0.5)’, class = ‘Intercept’, dpar = ‘mu2’) +

set_prior(‘gamma(9,3.5)’, class = ‘shape1’) +

set_prior(‘gamma(2.25, 1.25)’, class = ‘shape2’)

the model runs without problems. The model also runs **with** the logistic prior, but with `sample_prior = "no"`

. Any ideas why this occurs? What am I doing wrong?

Of course I’d be happy to provide more background in case that helps (but unfortunately I can’t provide the data without further ado).

**Update:** actually I just realized that model also runs with `sample_prior = "only"`

, which to me suggests it’s not just me miss-specifying the prior. Is this perhaps a bug then?

Please also provide the following information in addition to your question:

- Operating System: Windows 10 Enterprise, Version 1909, OS build 18363.657
- brms Version: 2.10.0