Population effect with nested random effect in some factor levels

  • Operating System: Windows 10 64-bit
  • brms Version: 2.4.0

Is there a way in brms to specify a population-level effect for which some levels contain their own group-level effects? My dataset has the following unique factor combinations:

Fluid  Sample
A      A1
A      A2
A      A3
B      B

where Fluid A has samples from three subjects, A1-A3, but Fluid B has samples from only one subject. Fluids A and B can be thought of as test levels (e.g., drug vs no drug), so I want to treat Samples A1-A3 as group-level, but Fluid as population-level.

If both Fluid and Sample are treated as group-level effects, then I think the model would be
y ~ (1|Fluid/Sample)
but I’m not sure how to specify Fluid as a population-level in brms. Does y ~ Fluid + (1|Fluid/Sample) make sense?

Thanks!

Yes, that would make sense. If Sample is unique across Fluids, then y ~ Fluid + (1|Sample) will also suffice.