Measurement error corrected hierarchical model in brms

  1. Have you released a vignette yet on measurement error using the brms package? I am trying to do a multilevel measurement error model but within a hierarchical structure.

The hierarchy is over time (year_cat5) and the measurement error is on the variable “Q” which we are using to explain the investment rate of firms (inv_rf).

  1. In, principle, in this formulation, for a hierarchical measurement error model in brms correct?

Family: student

Links: mu = identity; sigma = identity; nu = identity

Formula: inv_rf ~ me(Q_manual, Q_sd) + cashflow_rf + (1 + me(Q_manual, Q_sd) + cashflow_rf | year_cat5) + capital_output + fic_advanced_nousa

Data: data_STAN_lender_sam (Number of observations: 584)

Samples: 3 chains, each with iter = 4000; warmup = 2000; thin = 1;

total post-warmup samples = 6000

I ask because when adding the hierarchical structure the impact of the measurement error vanishes basically, Ie when running a ‘fixed effects’ measurement error it makes a big difference; but the hierarchical measurement error makes little difference.

  1. One issue is that I have a large dataset (360,000 data points. But it doesn’t seem to work with more 10,000 points or so. Understandable given that every datapoint will now be treated as an unknown parameter. What do you recommend to try work around this?

Best wishes,

our question:

  • Operating System:
  • brms Version:
1 Like
  1. Not yet. I am still waiting for measurement models to be implemented in brms (version 3.0 as it currently stands) and then perhaps combine it into one vignette.

  2. The specification looks reasonable to me.

  3. You could try overimputation to incorporate the measurement error for instance via the micemd package and then pass the results to brm_mutiple. This will require fitting the model multiple times
    but at least each model will run considerably faster.

sorry to bother with the same, but is there a draft?

I was trying to understand what exactly sdme and meanme are, but I couldn’t find anything in the help pages.

I understand. It is badly documented. Perhaps looking at the Stan code itself can help. I don’t like the me() feature anymore to be honest. It implictely adds a measurement model without a separate formula, as does mi(). For this reason, I will soon deprecate me() in favor of using mi(), which can be used for the same purpose, as soon as I have figure out how to add grouping (argument gr) to mi().

ok, thanks!
I’ll check mi() then, I wasn’t aware of it.

hey, yearly question, what’s happening with measurement error models in brms :)
Is me() getting deprecated? Should I teach (and write in our book) using mi()?

That’s still a good question. Before deciding to deprecate, I still need to implement the gr argument to mi() and confirm that mi() indeed can be (easily) made to do the same as me(). I am pretty sure on the latter, but I would appreciate people trying it out. With regard to the former, perhaps I can get this implemented soon.