possible brms problem in measurement error (on independent variable)

71 views
Skip to first unread message

Shravan Vasishth

unread,
Feb 19, 2018, 10:41:58 AM2/19/18
to brms-users
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? 

Paul Buerkner

unread,
Feb 19, 2018, 10:48:21 AM2/19/18
to Shravan Vasishth, brms-users
Try out

msVOT  ~ 1 + me(cmeanvdur,sestd) + (1 +  me(cmeanvdur,sestd) | subject)+(1 | item)

--
You received this message because you are subscribed to the Google Groups "brms-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brms-users+unsubscribe@googlegroups.com.
To post to this group, send email to brms-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brms-users/58e9a9ac-67c5-4ee6-8c25-65df5d9442ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shravan Vasishth

unread,
Feb 19, 2018, 10:52:05 AM2/19/18
to Paul Buerkner, brms-users
I think I see why that would work. Thanks, Paul.

--
Shravan Vasishth
Professor for Psycholinguistics and Neurolinguistics
Department of Linguistics
University of Potsdam, Germany
http://www.ling.uni-potsdam.de/~vasishth

Paul Buerkner

unread,
Feb 19, 2018, 10:53:26 AM2/19/18
to Shravan Vasishth, brms-users
Or maybe it doesn't, now that I rereed your post.

You are right to assume that brms treats this as measured for each observation. The code above may or may not get close to what you have in mind, but it will likely not be the same.

Shravan Vasishth

unread,
Feb 19, 2018, 10:56:19 AM2/19/18
to Paul Buerkner, brms-users
I will check this and get back to you. It may take a few days as I am working on several other deadlines.

--
Shravan Vasishth
Professor for Psycholinguistics and Neurolinguistics
Department of Linguistics
University of Potsdam, Germany
http://www.ling.uni-potsdam.de/~vasishth

Paul Buerkner

unread,
Feb 19, 2018, 5:21:24 PM2/19/18
to Shravan Vasishth, brms-users
The solution I proposed earlier today doesn't make sense in your case. brms is not yet able to express a variable with measurement error when multiple rows in the data belong to the same true score.

I should have read your model more carefully in the first place...

If you like, please feel free to open an issue on github (https://github.com/paul-buerkner/brms/issues) so that I don't forget about making this possible at some point.

Shravan Vasishth

unread,
Feb 20, 2018, 12:51:39 AM2/20/18
to Paul Buerkner, brms-users
Sure, I will do that. Thanks.
To unsubscribe from this group and stop receiving emails from it, send an email to brms-users+...@googlegroups.com.

Paul Buerkner

unread,
Mar 17, 2018, 12:58:53 PM3/17/18
to brms-users
In the new GithHub (and soon to be CRAN) version, you can now run me() terms with grouping factors: me(x, sdx, gr = <group>)
To unsubscribe from this group and stop receiving emails from it, send an email to brms-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages