4

I'm following up on this great answer. Given the structure of my data (below), is it possible to add a random-effect for H (a cluster ID variable) and X (a categorical variable not varying in H) as represented by the lme4 formula: ~ (1|H) + (1|X)?

If yes, would that indicate that H and X are crossed random-effects even though NO value of X is capable of meeting every value of H as suggested by this answer?

Finally, under nested random-effects, we say correlations exist among observations coming from the same cluster, but how do correlations come about under crossed random-effects as in my case?

H   X
1   2
1   2
2   1
2   1
2   1
3   2
4   1
rnorouzian
  • 3,986

1 Answers1

2

Yes, (1|H) + (1|X) would specify crossed random effects, when there is no nesting - you said that X doesn't vary within H and presumably the reverse is also true.

Does this also mean each unique H cluster is correlated with another H cluster AND each unique X cluster is correlated with another X cluster?

I'm not sure if I've understood that question, but the correlation is between observations within each cluster (of each variable), not between them.

Robert Long
  • 60,630
  • Thanks Robert. Three follow-up questions: (1) But here every value of X is NOT capable of meeting every value of H as suggested by linked answer for my random-effect to be crossed, so how come we still call X and H crossed? (2) (To clarify on what you said didn't understand) In nesting, we say correlations exist among observations coming from the same cluster, but how do correlations come about under crossed random-effects as in my case? (3) Under this random structure, neither H nor X can have an additional fixed effect in the model (H + X + (1|H) + (1|X)), correct? – rnorouzian Jul 17 '21 at 13:27
  • You're welcome :) (1) that doesn't make sense to me. Random effects are crossed when they are not nested. (2) Correlation within clusters has nothing to do with nesting - it is to do with repeated measures or some kind of clustering. We can have 2 or more grouping variables that are not nested (ie they are crossed), and for each variable we will have an intra-class correlation. (3) There is nothing stopping you from fitting H + X + (1|H) + (1|X) but specifying a variable as both random and fixed makes almost no sense to me and I would recommend not doing it. – Robert Long Jul 17 '21 at 20:49
  • So, based on your answer to (2), I conclude that observations belonging to the same H cluster are correlated with each other and separately observations belonging to the same X are correlated with each other, right? Can we also confirm partial crossing by: m = "H X 1 2 1 2 2 1 2 1 2 1 3 2 4 1"; dat=read.table(text=m,header=T); xtabs(~H+X,data = dat) ? – rnorouzian Jul 18 '21 at 00:16
  • They might be correlated. It's not certain, nor is it certain that the correlation would be higher enough to detect. As for confirming partial crossing - you can't know for sure because it depends on the study design and how the data are encoded. – Robert Long Jul 18 '21 at 08:38
  • 2
    Hi Robert, I think this question is of interest to you. Thank you. – rnorouzian Aug 11 '21 at 21:58