3
$\begingroup$

I realise this question reflects my ignorance more than anyone else, but if anyone can give me an answer I'd really appreciate it. I'm trying to understand mixed effects models. Let's say you've got a model with a random effect(group) with 50 levels and a fixed effect that you're fitting as a covariate. If you fitted a fixed-effects model with a group*covariate interaction you'd get a separate estimate for the slope and intercept for each group, but you'd use up a shedload of df. If you fit a random intercept and slopes model I get the bit about estimating the components of the variance arising from the groups represented by a random effect, but I'm finding it hard to work out how the model then produces group-level estimates for the intercept and slope without using up the same number of degrees of freedom that you'd use for the straight fixed-effects equivalent. Here's a toy example:

library(lme4)
library(dplyr)

# Fake explanatory variables
group <- rep(1:50, each = 5)
covar <- runif(250)

# Generate response variable
response <- 0.01*group + 2 * covar + rnorm(250)

# Fit random intercepts and slopes model
mod1 <- lmer(response ~ covar + (1+ covar|group))

# Extract coefficients
coef(mod1)$group %>% head(5)

Which gives you output something like this:

  (Intercept)    covar
1 -0.34799353 2.519426
2  0.24860259 2.161321
3 -0.01285849 2.301451
4 -0.30915518 2.424565
5 -0.30823363 2.635467

So the model is producing an estimate for the intercept and slope separately for each group: how does this work and why is it different from a fixed effects model? I guess the answer is somewhere in the black magic of how the random effect is fitted but I can't find a clear explanation of why this is different from doing it with a fixed effects model anywhere.

Any help much appreciated.

$\endgroup$
1
  • $\begingroup$ In the mixed model, the random effects (U) are not estimated, but they can be predicted. The variance is estimated. $\endgroup$ Oct 28 '20 at 13:55
3
$\begingroup$

Like penalized maximum likelihood estimation (e.g., ridge regression), random effects result in shrinkage of parameter estimates towards a common value. For example, in a 10-group problem, the use of random slopes may effectively assume for small samples that the 10 slopes are more alike than they are different. Information is borrowed across groups, reducing the variance of the slopes. Fixed effects tailor the slope estimates to each group, without shrinkage. This is effectively allowing the variance of the slopes to be arbitrarily large.

Shrinkage (discounting; penalization), by making parameter estimates smaller, reduces the effective degrees of freedom. Effective d.f. comes from something similar to the ratio of variance of a parameter estimate after and before shrinkage. If you were to impose a very small random effect variance (say with a Bayesian prior) the 10 slope estimates would be almost identical and you would effectively be estimating only one slope.

$\endgroup$
1
  • 1
    $\begingroup$ I second that, just to add that a) the assumed normal distribution for the RE corresponds EXACTLY to a ridge penalty b) however, unlike for the ridge, the mixed model optimizes the penalty via MLE (as the structure is part of the model assumptions) $\endgroup$ Oct 28 '20 at 14:36

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.