Polynomial regression with predictor measurement error

I want to predict a response variable y, from a predictor x and it’s square, when I have error in the measurement of x. This is all in the context of hierarchical ordinal regression. Since the formula syntax becomes a bit complicated, I wanted to make sure my implementation indeed does what I mean:

y ~ 1 + me(x, sdx, item) + I(me(x, sdx, item)^2) + 
  (1 + me(x, sdx, item) + I(me(x, sdx, item)^2) | participant) +
  (1 | item)

So above, I have y predicted by the latent variable underlying observations x, and it’s square. Intercepts and the two polynomial slopes vary by participant, intercept varies by item as well.

Is that correct? Is that the best implementation (I know that mi() does something similar, but I’m not sure when/how to use it).


  • Operating System: macosx 10.14.6
  • brms Version: 2.12.0
1 Like

Hi, sorry, your question seems to have slipped through the cracks. At first glance, this looks roughly OK, though I don’t know what the I calls are doing there. Anyway, general ways to check a model are:

  • using make_stancode to inspect the generated Stan code (it tends to be not 100% readable, but you can often get a rough understanding)
  • prior and posterior predictive checks (as in the Visualisation paper), also check out pp_check function.

Best of luck.