Hierarchically nested data in brms

I have some hierarchically nested data that I’m trying to model with brms. A simplified snapshot of the data is here:

Screen Shot 2020-05-04 at 4.07.04 PM
snapshot.csv (180 Bytes)

What I want to do is fit two models:

The first models outcome as a function of the treat and the dose. The problem is that dose is obviously missing for those that didn’t receive the treatment. Thus, I tried to model the this question in brms using this code:

brm(outcome ~ (1 | treat/dose) + (1 | id), data = snapshot)

Is this right? Will it be a problem that there are missing values for dose if treat == 0?

My second question is how can I further introduce brand to the model? For those that were treated, each dose was randomized to come from one of two brands: A or B. How can I model this interaction? My best guess with brms would be something like:

brm(outcome ~ (1 + brand | treat/dose) + (1 | id), data = snapshot)
  • Operating System: Mac OSX Mojave
  • brms Version: 2.12.0
1 Like

I think dose should simply be 0 if none was given or shouldn’t it?

1 Like

I guess that makes sense for dose. What about brand? What should that theoretically be given that it is only applicable of participants were in the treatment condition. Thus, an ‘NA’ seems right to me.

I don’t know as I am not from your field of research. I guess there are some common approaches to handle those cases? If you were intersted in comparing the brands, it seems sensible to me to just use the treatment group in a separate model as the control group does not provide any information regarding the two brands.