I am trying to fit a model on a set of data (e.g. 10,000 observations with 20 explanatory variables). The observations belong to 30 groups, G1, G2, G3, ... G30, so I need to account for the grouping factor by random effects. The problem is that many observations belong to several groups. For example, obs1 belongs to groups G1 and G5, obs2 belongs to G12, obs3 belongs to G5 and G12, etc. If each observation belonged to only one group I would include the random effects as (1|grouping_factor), in terms of the syntax of lmer, where grouping_factor is a categorical variable with 30 levels. But they belong to multiple groups. I know one way is to create new groups by combining the other groups, but that is not ideal, because it won't capture the similarities, for example, between the joint groups G1G2 and G1G3. What is a better way to do this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.