# What are the differences between the linear regression and mixed models?

What are the key differences between the following two models?

lmefit = lmer(MathAch ~ SES + (1 |School) , MathScores)

lmfit = lm(MathAch ~ SES + factor(School) -1 , MathScores)


To me, they seem to be the same, except that lmefit takes less parameters (because it used Normal distribution to model the levels at the group level...)

Am I right?

And what's the difference between these two models?

M0 <- lmer (y ~ 1 + (1 | county))
M1 <- lmer (y ~ -1 + (1 | county))

-
re: your second question - the second model drops the fixed intercept while the first does not; it effectively constrains the mean of the observations to be 0. I don't recommend the second model unless you have substantive theory which supports it. –  Macro May 31 '12 at 15:48
Thanks Macro. But I don't understand why it " it effectively constrains the mean of the observations to be 0. "? I was thinking that the (1 | county) has intercepts any way and the fixed-effect intercept can be absorbed those intercepts anyway –  Luna May 31 '12 at 15:51
the random effects have mean 0 so they cannot absorb the missing intercept the same way fixed effects can in a usual regression model. –  Macro May 31 '12 at 15:55
What the random effect to in a mixed model is increase uncertainty in the estimates because these effects are to be viewed as a sample from a large population as a center is in a muLticenter clinical trial. You may have chosen 15 centers out of thousands that could have been selected. This unseen variability that would show up of you repeated the trial with different centers need to be taken into account. –  Michael Chernick May 31 '12 at 16:19
In the Bates', yes, 0-mean was emphasized in the model definition; but in Gelman and Hill 2007, 0-mean is not in the model definition. Are you saying that "lmer" and "nlme" force 0-mean, since they were designed by Bates? Thank you! –  Luna May 31 '12 at 17:09
show 1 more comment

The main difference comes in what types of questions you are trying to answer with your analysis and how you consider the factor school.

In lmfit you are considering school to be a fixed effect, which means that you are only interested in the schools that are in your data set, but you are (possibly) interested in specific differences between the schools. With this model you cannot say anything about students at schools that are not in your sample (because you have no information on their fixed effect).

In lmefit your are considering school to be a random effect, or essentially the schools in your data set are a random sample from a larger population of larger schools. Here you are generally uninterested is specific comparison between schools, but could be interested in prediction for schools in the original sample and predictions for schools that were not in the original sample.

If I have data from all the schools in my area and am interested in seeing if there is a difference between 2 schools that I am considering sending my children to (and if so which is better) then I would use the fixed effects model.

If I am interested in making predictions and may make a prediction for schools not in my data set (since I only have a subset of the schools) then I would use the mixed effects model.

If I believe that there could be an effect due to schools, but I don't care specifically about comparisons between schools, just want to allow the model to adjust for the clustering, but will do all inference on the SES variable, then I would use the mixed effect model (though the fixed would work in this case, but using as an adjustment is a bit more natural as a random effect).

-
Thanks. But other than the difference in underlying universe, what are the other differences? My universe is fixed so I didn't randomly sample the "much larger" universe... in this case, the mixed model is of no benefit? –  Luna May 31 '12 at 17:24