I am running a location scale model looking at the difference between 2 clinical groups (Diagnosis) with data collected in two sites (Language)
Model2_Language_f <- bf(Outcome ~ 0 + language + language:Diagnosis +
(1 | p | gr(ID, by=group)),
sigma ~ 0 + language + language:Diagnosis +
(1 | p | gr(ID, by=group))
)
With a weakly informative prior all works fine:
PriorLS <- c(
prior(normal(0, .01), class = sd),
prior(normal(0, .05), class = b),
prior(normal(0,.05), class=b, dpar = sigma),
prior(normal(0,.01), class=sd, dpar = sigma),
prior(lkj(5), class = cor)
)
m <- brm(Model2_Language_f,
data = data,
family = gaussian,
iter = 2000,
chains = 2,
cores = 2,
prior = PitchMeanInformedPriorLS,
sample_prior = T
)
However, with an informed prior, I get an error:
PitchMeanInformedPriorLS <- c(
prior(normal(0, 0.1), class = sd) ,
prior(normal(0.38, 0.11), class = b),
prior(normal(-0.17, 0.11), class = b, coef = languagedk),
prior(normal(-0.17, 0.11), class = b, coef = languageus), #0.0763
prior(normal(0, 0.05), class = b, dpar = sigma),
prior(normal(0, 0.01), class = sd, dpar = sigma),
prior(lkj(5), class = cor)
)
Error:
Error in parse(text = expr) : :6:5: unexpected ‘)’
5: b_sigma
6: sd_1)
It all boils down to the sd priors: commenting them out the model compiles fine.
However, I cannot figure out what I am doing wrong in the sd priors…
Here also the data to make the issue reproducible: https://www.dropbox.com/s/pqkgnjj6y80zryo/temp_data.csv?dl=0
(I am using Rstudio with R 3.6 on mac, and latest brms github version)