I am using lmer()
in the "lme4" package to estimate multilevel models. The models include random intercepts for each group in my data. To fix ideas, here is a toy example:
library(lme4)
data(iris)
foo <- lmer(Sepal.Length ~ Sepal.Width + (1 | Species),
data = iris)
I would like to summarize the extent to which models like this shrink the estimates of the intercepts toward the grand mean of all intercepts, relative to the estimates that I would get from a simpler model, estimated with lm()
, that includes dummy variables for each group. How may I do this?
In their book, Gelman and Hill (2007, 477-80) refer to this summary statistic as a "pooling factor" and they note that others sometimes speak of a related "shrinkage factor." In their notation, the intercepts are $\theta_k = \hat{\theta}_k + \epsilon_k$ for $k = 1, \ldots, K$. They suggest estimating a summary of the extent to which the variance of the residuals $\epsilon_k$ is reduced by the pooling of the multilevel model: $$ \DeclareMathOperator*{\V}{V} L = 1 - \frac{\V_\limits{k=1}^KE(\epsilon_k)}{E\left(\V_\limits{k=1}^K \epsilon_k\right) }. $$ They give instructions for computing this quantity in BUGS. But is there a relatively simple way to do it in R?
Perhaps the numerator in the equation above corresponds to sigma(foo)^2
, but I'm not sure of that. And I don't have good ideas about how to compute the denominator. Can this information be extracted from objects created by lmer()
?
I've looked through CrossValidated and haven't found any posts on this point.
coef(foo)
versuscoef(loo)
, whereloo <- lm(Sepal.Length ~ 0 + Sepal.Width + Species, data = iris)
. The former will be the difference between the equations for the corresponding estimators. Or are you looking for something else? $\endgroup$