# Calculating variance components and ICC of a random intercept model by hand

When I really want to understand a measure or parameter, I tend to do the calculation by hand with simplified data. Today I have attempted to do the same with the ICC, but somehow keep failing. I was hoping someone could guide me trough the calculation, which I presumed to be fairly simple. But can't solve it nonetheless.

Consider the following data

 dat.example:

Group   X
1       4
1       5
1       6
2       8
2       9
2       13


$\sigma^2_u$ = 11.17

$\sigma^2_e$ = 4.00

$\rho = \frac{\sigma^2_u}{\sigma^2_u + \sigma^2_e} = \frac{11.17}{11.17 + 4} = 0.73$

These estimates are derived from the intercept-only model estimated in R using lme4 model.example <- lmer(X ~ 1 + (1|Group), dat.example), but I would like to be able estimate these variance components by hand as well.

I guess I solved it. Originally I missed the third step.

$$\sigma^2_e = S^2_{within}= \frac{\frac{(4-5)^2+(5-5)^2 +(6-5)^2}{3 - 1} + \frac{(8-10)^2+(9-10)^2 +(13-10)^2}{3 - 1}}{2} = \frac{1+7}{2} = 4$$

$$S^2_{between}= \frac{(10-5)^2+(7.5-5)^2}{2 - 1} = 12.5$$

$$\sigma^2_u = S^2_{between} - \frac{S^2_{within}}{\tilde{n}} = 12.5 - \frac{4}{3} = 11.17$$

$$\rho = \frac{\sigma^2_u}{\sigma^2_u +\sigma^2_e} = \frac{11.17}{11.17+4} = 0.73$$