Marginal effects plots (or something similar) for brms models with measurement error?

555 views
Skip to first unread message

Paul M

unread,
Jul 13, 2017, 12:54:29 PM7/13/17
to brms-users
Hi there,

   I am relatively new to the brms package, but I love the flexibility of it!  I am especially excited about the errors-in-variables models that can be implemented so easily in the formula.  I am currently working on a model that includes a population-level effect with measurement error.  For example:

model1 <- brm(response~ var1+ me(var2, var2.sd), data=data, family = bernoulli, iter=2000,save_mevars=TRUE)

    When I try to produce marginal effects plots (which are very handy for other brms models) for the population-level effects using:     

plot(marginal_effects(model1), points = TRUE)

    I receive the following error:       
 
Error: Predictions with noise-free variables are not yet possible when passing new data.

  I've tried a work around through predict.brmsfit and fitted.brmsfit to isolate the effect of the variable I am interested in that has measurement error, (var2 in the example above) but I keep encountering the same error.  Although, I'm sure this error is in place for a very good reason (does this have to do with problems in predictions for newdata when the measurement error isn't known?), I was wondering if there is any sensible (and reasonable) work around to produce some plots that would be similar to the marginal effects plots for models that have population-level effects with measurement error?

  I had a read through the very interesting discussion regarding the initial implementation of errors-in-variables in brms (https://github.com/paul-buerkner/brms/issues/114), but I couldn't find anything on the marginal plots or predicting with new data.  Apologies if I'm missing something obvious here and thank you very much in advance for any help you can offer!

Sincerely,
 Paul

Paul Buerkner

unread,
Jul 13, 2017, 2:51:35 PM7/13/17
to brms-users
I will have to think a bit more about a valid way to allow predictions for measurement error variables in case of new data.

The thing is that the "variable" used in the predictions for the original data is actually a vector of parameter values for which a full joint posterior distribution with all other parameters is available.

If these parameters were actually indepedent of all other parameters, it would not be too difficult to allow predictions for new data, but I doubt that this independence generally holds.

Any suggestions are welcome :-)

Paul M

unread,
Jul 14, 2017, 7:22:34 AM7/14/17
to brms-users
Hi Paul -
 
   Thanks so much for looking into this.  I'm currently having a look through some of the INLA literature regarding measurement error models (e.g., Huff et al. 2014, http://onlinelibrary.wiley.com/doi/10.1111/rssc.12069/abstract, http://www.r-inla.org/examples/case-studies/muff-etal-2014) to see if I can dig up anything on predictions for new data.  I realise that brms and INLA take different routes to get to the posterior, but I thought that maybe predictions for new data from measurement error models might face similar challenges between the two?   Haven't found anything yet, but will keep searching. 
Thanks again!  
Reply all
Reply to author
Forward
0 new messages