Hi Paul,
I am trying to fit this model below:
m2Mbrm <- brm(formula = msVOT ~ 1 + me(cmeanvdur,sestd) + (1 | subject)+(1 | item),
data = Mdatmerged,
family = gaussian(),
prior = priors,
warmup = 1000, iter = 2000,
chains = 4,
control = list(adapt_delta = 0.95))
The data frame has a single centered mean vowel duration value (cmeanvdur) for each subject, but I have it on authority from a local brms/Stan expert (I leave it as an exercise to guess who that might be) that brms thinks that this predictor was measured for *each* observation, which is obviously false because I have repeated measures from each subject for the dependent variable. So, brms tries to estimate the true vowel duration for each observation, not each subject. In pure Stan I can of course deal with this easily by writing a separate for loop that loops over the subject variable, and I can explicitly specify that each *subject* has a true underlying vowel duration. Does brms have a mechanism for constraining the estimation in this way? My for loop for the Stan model looks like this. I don't write a for-loop but rather specify the true_mvdur indexing by subj id:
Code in pure Stan inside model block:
true_mvdur ~ normal(0, 200);
meanvdur ~ normal(true_mvdur, se); // measurement model
mu = beta[1] + u[subj] + w[item] + beta[2] * true_mvdur[subj];
How do I achieve this in brms?