# Are random effects confounding variables?

Are random effects confounding variables? Are the fixed effect coefficients in mixed model output adjusted for the confounding effect of the random effects?

Random effects are confounding variables if the variables they represent cause selection into the exposure and variation in the outcome. For example, if what school a student attends both affects their propensity to be suspended and their academic success, then a random effect varying by school may account for this confounding relationship. When school does not affect academic success or when school does not affect the propensity to be suspended, then school is not a confounder. In the former case, it is a prognostic variable and in the latter case, it is an instrumental variable.

When confounding exists at the cluster level (i.e., when cluster-level characteristics affect assignment to exposure and variation in the outcome at the individual-level), then controlling for cluster membership (i.e., not controlling for cluster-level characteristics themselves) removes cluster-level confounding. For example, if whether a school was unionized affected academic success and propensity to suspend students, then simply controlling for school membership would adjust for confounding by this school-level characteristic, even if whether a school is unionized is not observed in the data. This could be accomplished either by a fixed effect for school (i.e., include school as a standard categorical variable) or a random effect varying by school (i.e., in a mixed model). This is the benefit of accounting for cluster membership using fixed or random effects: they adjust for cluster-level confounding even by unobserved cluster-level confounding variables. When the participant is the cluster and measurements from a participant are the units of analysis, adjusting for participant can control almost all of the confounding, which is why within-subject designs are so powerful when correctly analyzed.

You can think of random effects as if you included the cluster variable simply as a covariate in the analysis. The interpretation of the coefficients of the other parameters is the same: adjusting for cluster membership, what is the effect of the predictor on the outcome? Random effects simply make the model more parsimonious by only estimating a few extra parameters (the mean and variance of the distribution of the random effect and possibly its covariance with other random effects) while the fixed effect version requires estimating a parameter for each cluster. The parsimony comes at the cost of more assumptions, which, if violated, can reduce the ability of the random effect to eliminate cluster-level confounding.

• If I have time as a random effect, may I not specify it as a fixed effect and expect time to be controlled for assuming it’s a confounding variable?
– user271077
Feb 20, 2020 at 21:00
• By "having time as a random effect", do you mean that you have a random slope on time and measurements are nested within individuals, or is time somehow the clustering variable (e.g., if you make multiple measurements at the same time)?
– Noah
Feb 20, 2020 at 22:23
• +1 @Noah. Great answer! It is also worth mentioning that in a random effects model, to get the true within-cluster effect of a predictor on the outcome, you must either a) add the cluster mean of that predictor as a fixed effect (sometimes called the Mundlak approach) and/or b) center that within-cluster predictor around its cluster mean (sometimes called the within-between approach). Feb 21, 2020 at 3:13
• @Noah yes, that’s what I meant time as random slopes
– user271077
Feb 21, 2020 at 3:45