Is it correct for me to presume that it would be bad modeling practice to construct a mixed model where a fixed effect "groups" ("is nested"?) perfectly within a random grouping variable?

For example: Median income of a census tract would, of course, "group" perfectly within census tract. So, this would be bad practice?

Mortgage.Success ~ Race + Individual.Income + Tract.Income + (1 | Tract)

Instead, something like

Mortgage.Success ~ Race + Individual.Income + (1 | Tract)

would be appropriate? Both models will "run" in that lme4 will do the calculations and converge, but I have "funny feeling" about the first model because there will be a perfect correspondence between "Tract.Income" and "Tract". Or does mixed-level modeling not worry about that?

  • $\begingroup$ Not only it's not a bad practice, but it's in fact sometimes explicitly recommended, see e.g. stat.columbia.edu/~gelman/research/unpublished/…. $\endgroup$
    – amoeba
    Jun 9, 2017 at 10:52
  • $\begingroup$ If you want to do more reading on that, then this thread stats.stackexchange.com/questions/56695 has a great answer that is related. $\endgroup$
    – amoeba
    Jun 9, 2017 at 12:53
  • $\begingroup$ I am going to ask a silly question to see if I understood the paper you linked: Is "Tract.Income" that "mean per group" that the paper recommends? $\endgroup$
    – Bryan
    Jun 9, 2017 at 12:54
  • $\begingroup$ Also, would random slopes in addition to random intercepts be recommended? $\endgroup$
    – Bryan
    Jun 9, 2017 at 12:56
  • $\begingroup$ Yes. Well, you wrote that it's a "median" and not a mean, but this should not influence the general logic. Whether you want random slopes is an unrelated issue. If you have enough data to estimate them then why not. $\endgroup$
    – amoeba
    Jun 9, 2017 at 12:57

2 Answers 2


I think there's some misunderstanding about what perfect grouping is. Perfect grouping would be if you adjusted for a categorical variable of census tract as both a fixed effect and random effect. R does not converge in that case. That's not what happens in the first model. If tract.income is a unique variable for each tract and you adjust it as a factor, instead of continuously or pseudocontinuously, this problem arises because incomes are interchangeable with tract labels. Again, R would throw an error in this case.

Your first model merely adjusts for a between-cluster predictor of the outcome. This is a totally sensible approach in mixed effects models when it would be appropriate in a fixed effects model. Adjusting for a between-cluster variable is superior to the random effect in a few ways in that it actually estimates a mean difference: this mean difference enables comparisons of people between different clusters. So, for instance, if John Doe applies for a mortgage in a poor neighborhood I know his mortgage success will be closer to that of other poor neighborhoods even if they are not his poor neighborhood. A random effect only tells us people in the same census tract/neighborhood are similar.

Adjusting for between cluster factors can make for better comparison of race to mortgage success. The key assumption here is that census tract income predicts or is independent of race, conditional on individual income. I think that assumption is testy at best. Racial groups, conditional on individual income, tend to cluster geographically in similar areas.

When doing research on disparities (which I catch the jist of based on the variables), I often report the marginal and conditional differences, e.g. blacks were less likely to receive mortgages than whites, but after control of median tract income and personal income, differences were not observed.

  • $\begingroup$ (+1) I don't quite understand the emphasis in this sentence: "This is a totally sensible approach in mixed effects models when it would be appropriate in a fixed effects model" -- could you clarify? So it's not always sensible, it's ONLY sensible when it's appropriate in a FE model? When would it be appropriate in a FE model, and when not? $\endgroup$
    – amoeba
    Jun 9, 2017 at 11:53
  • 1
    $\begingroup$ @amoeba Good point. When studying associations in observational data, we adjust for variables in a fixed effects model to control for confounding and/or to add precision. We do not control for variables if they have no purported relation with a causal model, if they are colliders or if they are mediators. Neighborhood/census tract level variables can in many ways be formulated as confounders. Simply specifying a random effect tells us that people within such clusters are correlated, but adjusting for between-cluster confounders actually controls for their impact and gives better inference. $\endgroup$
    – AdamO
    Jun 9, 2017 at 15:18

is tract.income the income of tract? In that case, wouldnt you care most about the interaction between individual and tract?

if so your model probably needs this (Individual.Income * Tract.Income | Tract). It would seem like you would care about the interaction between the income member of the individual and the overall income of their associated group.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.