I am working on a multi-level model predicting whether a student is disciplined based on race, gender, and socio-economic status.

I have a database of 41,102 students, of which 9,341 (approximately 23%) received discipline at least once during the school year.

My variables are:

  • discipline - factor, 1=received discipline, 0=did not
  • dummy[race] - dummy variables for 4 races, leaving out White
  • dummy[race]cent - grand mean centered dummy variables for race. This was recommended by my adviser to help us interpret the intercept as the log-odds of being disciplined at a "typical" school
  • dummy[race]schcent - school (group) mean centered dummy variables for race. This should let me interpret the intercept as the log-odds of being disciplined for the typical student.

I'm doing my analysis in R, using the glmer function from the lme4 package. I introduced this question earlier and got some very helpful feedback.

My problem now is that the intercepts don't seem to match my data. I'll include my models below, trimmed to just show the glmer code and the intercept.

I ran a null model to see if the log-odds are different from 0:

glmer(discipline ~ 1 + (1|school), family = binomial, data=U46sub)
(Intercept)  -2.6598     0.2607   -10.2   <2e-16 ***

In this case, the log-odds are significantly different from 0 (not that interesting). If I convert the intercept to a probability, I get 1/(1+e^-(-2.6598)) = 0.065. This is far from the proportion of students disciplined.

Model 2: Using the dummy variables for race as predictors. The intercept here should be the log-odds of being disciplined for a White student (the reference category).

glmer(discipline ~ dummyAsian + dummyBlack + dummyHisporLat
                   + dummyTwoorMore + (1|school), family = binomial, data=U46sub)
(Intercept)    -3.04349    0.26472 -11.497   <2e-16 ***

Changing the intercept here to probability, I get 1/(1+e^-(-3.04349)) = 0.045. From my data, approximately 18% of white students received discipline, so this does not match, either.

Using the group-centered dummy variables, I get:

glmer(discipline ~ dummyAsianschcent + dummyBlackschcent +
             + dummyHisporLatschcent + dummyTwoorMoreschcent + (1|school),
             + family = binomial, data=U46sub))
(Intercept)           -2.46449    0.25911  -9.511   <2e-16 ***

So this intercept should be the log-odds of being disciplined by a typical student, but again, it is much too low. 1/(1+e^-(-2.46449)) = 0.078.

I did the same with the overall mean centered predictors, so the intercept should be the log-odds of being disciplined at a "typical" school, and I had similar results - a probability below 10% of being disciplined.

So what is happening? Could there be some error in my coding of the variables? So far, I've checked that the mean of the dummy variables is the same as the overall proportion for that race in my dataframe, and I've checked that the mean of the mean centered dummy variables is 0 for each.


The difference is the algorithm mean and the lease square mean. Your 23% is algorithm mean (9341/41012) while your model based percentage (probability) is lease square mean. If the number of student in each school are quite different it would expect the two means are different.

read this blog: http://onbiostatistics.blogspot.com.au/2009/04/least-squares-means-marginal-means-vs.html

It is quite helpful.

  • $\begingroup$ Thanks! I ran the analysis on a subset of schools with similar enrollments (300<enr<700), and the results were much closer - an algorithmic mean of 15%, and the least squares mean of about 11%. $\endgroup$ – dankernler Jun 21 '17 at 5:16

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.