Professional Documents
Culture Documents
= σb2 + σε2
and we refer to σb2 and σε2 as variance components.
• The intraclass correlation is defined as the ordinary correla-
tion between two different observations (j 6= j 0) in the same cluster
(e.g., worker or clinic), i.e., with the same i:
E[(Yij − µ)(Yij 0 − µ)]
ρ =
σ2
E[(bi + εij )(bi + εij 0 )]
=
σ2
E(b2i ) σb2
= = 2
σ2 σb + σε2
. use machine
. table id, c(n output mean output sd output)
----------------------------------------------------
id | N(output) mean(output) sd(output)
----------+-----------------------------------------
1 | 2 9.15 1.06066
2 | 4 9.475 .801561
3 | 3 8.266666 .9291573
4 | 4 8.200001 1.055146
5 | 3 15.03333 .8144526
6 | 2 11.55 1.06066
7 | 2 11.45 1.909188
8 | 4 11.525 1.021029
9 | 3 11.26667 .7234181
10 | 3 10.13333 1.289703
11 | 3 11.13333 .8082907
13 | 3 16.1 1.5
14 | 3 18.96667 2.150193
15 | 4 15.35 2.330236
16 | 3 16.6 1.83303
17 | 4 15.3 1.783255
18 | 4 14.35 2.176389
19 | 3 10.43333 .6506408
----------------------------------------------------
. gen cons=1
. xtreg output cons, i(id)
Random-effects GLS regression Number of obs = 57
Group variable (i) : id Number of groups = 18
R-sq: within = . Obs per group: min = 2
between = . avg = 3.2
overall = 0.0000 max = 4
Random effects u_i ~ Gaussian Wald chi2(0) = 279.17
corr(u_i, X) = 0 (assumed) Prob > chi2 = .
------------------------------------------------------------------
output | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------+----------------------------------------------------------
cons | 12.4697 .7463195 16.71 0.000 11.00694 13.93246
_cons | (dropped)
-------------+----------------------------------------------------
sigma_u | 3.0496204
sigma_e | 1.4708855
rho | .81127331 (fraction of variance due to u_i)
------------------------------------------------------------------
• Estimates:
◦ σ̂b2 = sigma u ≈ 3.05
◦ σ̂ε2 = sigma e ≈ 1.47
◦ ρ̂ = rho ≈ 0.81.
• The intra-class correlation is over-stated because the model fails to
take into account that workers use different machines.
----------------------------------------------------------------------
output | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------+---------------------------------------------------------
_Imachine_2 | 3.667751 1.120799 3.27 0.001 1.471026 5.864476
_Imachine_3 | 2.080964 1.197118 1.74 0.082 -.2653444 4.427272
_Imachine_4 | 7.963425 1.102605 7.22 0.000 5.802359 10.12449
_Imachine_5 | 4.671042 1.179784 3.96 0.000 2.358708 6.983377
_cons | 8.763481 .7820011 11.21 0.000 7.230787 10.29617
------------+---------------------------------------------------------
sigma_u | 1.3174599
sigma_e | 1.4708855
rho | .44514222 (fraction of variance due to u_i)
----------------------------------------------------------------------
-2.12025
-1.58975 1.58975
Inverse Normal
-2.71672
-2.71672 2.71672
Inverse Normal
1.8383
ALPHA
-2.12025
-2.0325 3.12287
EPSILON
• According to model
Ȳmi = µm + bmi + ¯mi.
• When the bmi and εmij are assumed to have independent normal
distributions (as they are here), then
σ̂b2
b̃mi = b̂mi
σ̂b2 + σ̂ε2/nmi
ρ̂
= (ȳmi − µ̂m)
ρ̂ + 1/nmi
◦ “Empirical” Bayes from fact that estimates are substituted for
the variance components (instead of treating them as random
also)
◦ As nmi ↑ ∞ BLUP → fixed effect
• BLUP of output for worker (m, i) is
µ̃mi = µ̂m + b̃mi
• We have
µ̃mi = µ̂m
|{z} + b̃mi
|{z}
marginal mean random effect
. predict MEAN, xb
. predict BLUP, xbu
. gr Y_AVE MEAN BLUP id, s(ToS) c(.J.) xlabel(0(4)20)
8.2
0 4 8 12 16 20
id