Measurement error models in brms with error on both independent and dependent variables


I was excited to find that brms has a built in function for incorporating the measurement error of predictors into models (see: me: Predictors with Measurement Error in 'brms' Models in brms: Bayesian Regression Models using 'Stan'). I am interesting in running a simple linear model (y~x) in which both the x and y variables include measurement area.

It seems to me that the me() function cannot be implemented as a response variable on the left side of the equation (see sample code below).

Does anyone know of a way around this to implement such a model?
I am using brms version 2.11.1 on a mac High Sierra OS.



#generate simple dataframe with measurement error on x and y
N <- 100
dat <- data.frame(
  y = rnorm(N), sdy = abs(rnorm(N, 1)),
  x = rnorm(N), sdx = abs(rnorm(N, 1))

# try to fit an error in variable model and fail
fit1 <- brm(me(y,sdy) ~ me(x, sdx), data = dat, 
            save_mevars = TRUE)
1 Like

Hi, please see here:

15 Missing Data and Other Opportunities | Statistical rethinking with brms, ggplot2, and the tidyverse: Second edition and in particular Section 15.1.1.


Thanks for your response. This resource is super helpful!