Multicollinearity, Effect Size, Design Effects, and Power Analysis
University of Southern California
2024-03-22
\[ \DeclareMathOperator{\Tr}{Tr} \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\cov}{Cov} \DeclareMathOperator{\null}{N} \newcommand{\bv}[1]{\boldsymbol{\mathbf{#1}}} \]
\[ \bv y = \bv X \color{red}{\bv \gamma} + \bv Z \color{blue}{\bv u} + \bv e \]
\[ \begin{bmatrix} 10 \\5 \\5 \\7 \\5 \\5 \\5 \\8 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 2 \\1 & 0 & 0 \\1 & 0 & 1 \\1 & 0 & 2 \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 1 \end{bmatrix} \begin{bmatrix} \color{red}{{\gamma_0}} \\ \color{red}{{\gamma_1}} \\ \color{red}{{\gamma_2}} \end{bmatrix} + \begin{bmatrix} 1 & & 2 & \\1 & & 0 & \\1 & & 1 & \\1 & & 2 & \\ & 1 & & 1 \\ & 1 & & 2 \\ & 1 & & 2 \\ & 1 & & 2 \end{bmatrix} \begin{bmatrix} \color{blue}{{u_{01}}} \\\color{blue}{{u_{02}}} \\\color{blue}{{u_{11}}} \\\color{blue}{{u_{12}}} \end{bmatrix} + \begin{bmatrix} e_{11} \\e_{12} \\e_{13} \\e_{14} \\e_{21} \\e_{22} \\e_{23} \\e_{24} \end{bmatrix} \]
\[ \begin{bmatrix} \color{orange}{{10}} \\ \color{orange}{{5}} \\ \color{orange}{{5}} \\ \color{orange}{{7}} \\5 \\5 \\5 \\8 \end{bmatrix} = \begin{bmatrix} \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{0}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{1}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 1 \end{bmatrix} \begin{bmatrix} \color{red}{{\gamma_0}} \\ \color{red}{{\gamma_1}} \\ \color{red}{{\gamma_2}} \end{bmatrix} + \begin{bmatrix} \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{0}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{1}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\ & 1 & & 1 \\ & 1 & & 2 \\ & 1 & & 2 \\ & 1 & & 2 \end{bmatrix} \begin{bmatrix} \color{orange}{{u_{01}}} \\u_{02} \\ \color{orange}{{u_{11}}} \\u_{12} \end{bmatrix} + \begin{bmatrix} \color{orange}{{e_{11}}} \\ \color{orange}{{e_{12}}} \\ \color{orange}{{e_{13}}} \\ \color{orange}{{e_{14}}} \\e_{21} \\e_{22} \\e_{23} \\e_{24} \end{bmatrix} \]
For cluster \(j\), \(\bv y_j = \bv X_j \bv \gamma + \bv Z_j \bv u_j + \bv e_j\)
\[ \bv y = \bv X \color{red}{\bv \gamma} + \bv Z \color{blue}{\bv u} + \bv e \]
In regression, we look at
If \(X_1\) and \(X_2\) are uncorrelated, \({\bv x_1^c}^\top \bv x_2^c = 0\), and variance accounted for by the two predictors are separate
If \(X_1\) and \(X_2\) are correlated, \({\bv x_1^c}^\top \bv x_2^c \neq 0\), then adding \(X_2\) . . .
\[ \begin{bmatrix} \color{orange}{{10}} \\ \color{orange}{{5}} \\ \color{orange}{{5}} \\ \color{orange}{{7}} \\5 \\5 \\5 \\8 \end{bmatrix} = \begin{bmatrix} \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{0}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{1}} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 2 \\1 & 1 & 1 \end{bmatrix} \begin{bmatrix} \color{red}{{\gamma_0}} \\ \color{red}{{\gamma_1}} \\ \color{red}{{\gamma_2}} \end{bmatrix} + \begin{bmatrix} \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{0}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{1}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\ & 1 & & 1 \\ & 1 & & 2 \\ & 1 & & 2 \\ & 1 & & 2 \end{bmatrix} \begin{bmatrix} \color{orange}{{u_{01}}} \\u_{02} \\ \color{orange}{{u_{11}}} \\u_{12} \end{bmatrix} + \begin{bmatrix} \color{orange}{{e_{11}}} \\ \color{orange}{{e_{12}}} \\ \color{orange}{{e_{13}}} \\ \color{orange}{{e_{14}}} \\e_{21} \\e_{22} \\e_{23} \\e_{24} \end{bmatrix} \]
\[ \begin{bmatrix} \color{orange}{{10}} \\ \color{orange}{{5}} \\ \color{orange}{{5}} \\ \color{orange}{{7}} \\5 \\5 \\5 \\8 \end{bmatrix} = \begin{bmatrix} \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} & \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{0}} & \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{0}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{1}} & \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{1}} & \color{orange}{{ }} \\ \color{orange}{{1}} & \color{orange}{{0}} & \color{orange}{{2}} & \color{orange}{{1}} & \color{orange}{{ }} & \color{orange}{{2}} & \color{orange}{{ }} \\1 & 1 & 2 & & 1 & & 1 \\1 & 1 & 2 & & 1 & & 2 \\1 & 1 & 2 & & 1 & & 2 \\1 & 1 & 1 & & 1 & & 2 \end{bmatrix} \begin{bmatrix} \color{red}{{\gamma_0}} \\ \color{red}{{\gamma_1}} \\ \color{red}{{\gamma_2}} \\ \color{orange}{{u_{01}}} \\u_{02} \\ \color{orange}{{u_{11}}} \\u_{12} \end{bmatrix} + \begin{bmatrix} \color{orange}{{e_{11}}} \\ \color{orange}{{e_{12}}} \\ \color{orange}{{e_{13}}} \\ \color{orange}{{e_{14}}} \\e_{21} \\e_{22} \\e_{23} \\e_{24} \end{bmatrix} \]
In MLM, we also look at
\(\bv Z^\top \bv Z\), cross-products among columns of \(\bv Z\), and
\({\bv X^c}^\top \bv Z\), cross-products between columns of \({\bv X^c}\) and those of \(\bv Z\)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.67 -0.33 -0.33 0.00 0.00 0.00
[2,] -0.33 0.67 -0.33 0.00 0.00 0.00
[3,] -0.33 -0.33 0.67 0.00 0.00 0.00
[4,] 0.00 0.00 0.00 0.67 -0.33 -0.33
[5,] 0.00 0.00 0.00 -0.33 0.67 -0.33
[6,] 0.00 0.00 0.00 -0.33 -0.33 0.67
[1] -1 -1 -1 1 1 1
Level-2 predictor can only account for level-2 variance
[1] -2 0 2 -3 2 1
Pure level-1 predictor can only account for level-1 variance
[1] -1 1 2 -3 0 1
Level-1 predictor can account for both level-2 and level-1 variance
[,1] [,2]
[1,] -1 0
[2,] 1 0
[3,] 2 0
[4,] 0 -3
[5,] 0 0
[6,] 0 1
Using simulations, we found that, when clustering is ignored, SEs of the following are underestimated
Because they all correlate with \(\bv Z\)!
Additional Questions
Conditional on \(\bv X\)
\[ V(\bv Z \bv u + \bv e) = \sigma^2 \bv V = \sigma^2 [\bv Z (\bv D \otimes \bv I_J) \bv Z^\top + \bv I], \]
Unconditional (\(\bv X^c\) = grand-mean centered \(\bv X\))
\[ \underbrace{\bv X^c \bv \gamma \bv \gamma^\top {\bv X^c}^\top}_{\text{fixed}} + \underbrace{\sigma^2 \bv Z (\bv D \otimes \bv I_J) \bv Z^\top}_{\text{random lv-2}} + \underbrace{\sigma^2 \bv I}_{\text{random lv-1}}. \]
\[ \begin{aligned} \Tr[V(\bv y)] / N & = \bv \gamma^\top {\bv X^c}^\top {\bv X^c} \bv \gamma / N \\ & \quad + \sigma^2 \Tr[\bv Z (\bv D \otimes \bv I_J) \bv Z^\top] / N + \sigma^2 \end{aligned} \]
\[ \Tr[V(\bv y)] / N = \bv \gamma^\top \bv \Sigma_X \bv \gamma + \sigma^2 [\Tr(\bv D \bv K_Z) + 1], \]
Let \(\bv X^r\) be the design matrix of variables with random effects1
Unconditional or Conditional on the fixed effects
\[ \mathrm{ICC}_{D} = \frac{\Tr(\bv D \bv K_Z)}{\Tr(\bv D \bv K_Z) + 1}, \]
Proportion of variance by fixed effects (see Johnson, 2014; Rights & Sterba, 2019)1
\[ R^2_\text{GLMM} = \frac{\bv \gamma^\top \bv \Sigma_X \bv \gamma}{\bv \gamma^\top \bv \Sigma_X \bv \gamma + \sigma^2 [\Tr(\bv D \bv K_Z) + 1]}. \]
Code Example
Linear mixed model fit by REML ['lmerMod']
Formula: mAch ~ ses + meanses + (ses | school)
Data: Hsb82
REML criterion at convergence: 46561.4
Scaled residuals:
Min 1Q Median 3Q Max
-3.1671 -0.7269 0.0163 0.7547 2.9646
Random effects:
Groups Name Variance Std.Dev. Corr
school (Intercept) 2.695 1.6418
ses 0.453 0.6731 -0.21
Residual 36.796 6.0659
Number of obs: 7185, groups: school, 160
Fixed effects:
Estimate Std. Error t value
(Intercept) 12.6740 0.1506 84.176
ses 2.1903 0.1218 17.976
meanses 3.7812 0.3826 9.882
[,1]
[1,] 8.190918
Code Example (cont’d)
library(r2mlm)
library(MuMIn)
# R^2 using formula, r2mlm::r2mlm(), and MuMIn::r.squaredGLMM()
list(formula = vf / (vf + vr + sigma(m1)^2),
r2mlm = r2mlm(m1),
MuMIn = MuMIn::r.squaredGLMM(m1))
$formula
[,1]
[1,] 0.170797
$r2mlm
$r2mlm$Decompositions
total
fixed 0.170816580
slope variation 0.005737776
mean variation 0.056202223
sigma2 0.767243421
$r2mlm$R2s
total
f 0.170816580
v 0.005737776
m 0.056202223
fv 0.176554356
fvm 0.232756579
$MuMIn
R2m R2c
[1,] 0.1708167 0.232756
Confidence interval of \(R^2\)
lme4::bootMer()
or R package bootmlm)1Additional Questions
SMD = Mean difference / \(\mathit{SD}_p\)1
For cluster-randomized trials
\[ Y_{ij} = T_j \gamma + Z_{0j} u_{0j} + e_{ij}, \quad V(u_{0j}) = \tau_0^2 \]
\(T_j\) = 0 (control) and 1 (treatment)
\[ \delta = \frac{\gamma}{\sqrt{\sigma^2[\Tr(\bv D \bv K_Z) + 1]}} = \frac{\gamma}{\sqrt{\tau^2_0 + \sigma^2}} \]
More general form:
\[ \delta = \frac{\text{adjusted/unadjusted treatment effect}}{\sqrt{\text{average conditional variance of } \bv y}} \]
\[ \delta = \frac{E[E(Y | T = 1)- E(Y | T = 0) | \bv C]}{\sqrt{\Tr [V(\bv X \bv \gamma | T) + V(\bv Z \bv u | T)] / N + \sigma^2}} \]
where \(\bv C\) is the subset of covariates for adjusted differences
\[ f^2_\text{GLMM} = \frac{R_\text{GLMM}^2}{1 - R_\text{GLMM}^2} \]
Additional Questions
\[ \gamma^s = \gamma \frac{\mathit{SD}_x}{\sqrt{\Tr[V(\bv y)] / N}} \]
Linear mixed model fit by REML ['lmerMod']
Formula: mAch ~ ses + meanses + (ses | school)
Data: Hsb82
REML criterion at convergence: 46561.4
Scaled residuals:
Min 1Q Median 3Q Max
-3.1671 -0.7269 0.0163 0.7547 2.9646
Random effects:
Groups Name Variance Std.Dev. Corr
school (Intercept) 2.695 1.6418
ses 0.453 0.6731 -0.21
Residual 36.796 6.0659
Number of obs: 7185, groups: school, 160
Fixed effects:
Estimate Std. Error t value
(Intercept) 12.6740 0.1506 84.176
ses 2.1903 0.1218 17.976
meanses 3.7812 0.3826 9.882
Correlation of Fixed Effects:
(Intr) ses
ses -0.084
meanses -0.013 -0.256
For cluster means and cluster-mean centered variables, it is still natural to use the total SD
Design effect: Expected impact of design on sampling variance of an estimator1
For the sample mean \((\hat \mu)\):
\[ \mathrm{Deff}(\hat \mu) = \frac{V_\text{SRS}(\hat \gamma_0)}{V_\text{MLM}(\hat \mu_\text{SRS})} = \color{red}{1 + (n - 1) \textrm{ICC}} \]
\(\mathrm{Deff}(\hat \mu)\) Does Not Inform About Random Slopes
\[ \hat{\bv \gamma} = (\bv X^\top \bv V^{-1} \bv X)^{-1} \bv X^\top \bv V^{-1} \bv y \]
\[ \begin{aligned} V_\text{MLM}(\hat{\bv \gamma}^\text{GLS}) & = \sigma^2 (\bv X^\top \bv V^{-1} \bv X)^{-1} \\ V_\text{SRS}(\hat{\bv \gamma}^\text{OLS}) & = \tilde \sigma^2 (\bv X^\top \bv X)^{-1} \end{aligned} \]
where \(\tilde \sigma^2 = \sigma^2 [\Tr(\bv D \bv K_Z) + 1]\)
Unpacking \(V(\hat{\bv \gamma}^\text{GLS})\)
\[ \begin{aligned} \sigma^2 ({\bv X}^\top \bv V^{-1} {\bv X})^{-1} & = \sigma^2 \{{\bv X}^\top [\bv Z (\bv D \otimes \bv I_J) \bv Z^\top + \bv I]^{-1} {\bv X}\}^{-1} \\ & = \sigma^2 \{{\bv X}^\top [\bv I - \bv Z (\bv D \otimes \bv I_J^{-1} + \bv Z^\top \bv Z) \bv Z^\top] {\bv X}\}^{-1} \\ & = \sigma^2 \{{\bv X}^\top {\bv X} - {\bv X}^\top \bv Z (\bv D \otimes \bv I_J^{-1} + \bv Z^\top \bv Z) \bv Z^\top {\bv X}\}^{-1} \\ & = \sigma^2 \{[({\bv X}^\top {\bv X})^{-1} + ({\bv X}^\top {\bv X})^{-1} {\bv X}^\top \bv Z (\bv D \otimes \bv I_J) \bv Z^\top {\bv X} ({\bv X}^\top {\bv X})^{-1} ]^{-1} \}^{-1} \\ & = \sigma^2 [({\bv X}^\top {\bv X})^{-1} + ({\bv X}^\top {\bv X})^{-1} {\bv X}^\top \bv Z (\bv D \otimes \bv I_J) \bv Z^\top {\bv X} ({\bv X}^\top {\bv X})^{-1} ] \end{aligned} \]
We can substitute \(\bv X\) with \(\bv X^c\). As \(\bv Z\) is block diagonal, \({\bv X^c}^\top \bv Z\) = \([{\bv X^c}^\top_1 \bv Z_1 | {\bv X^c}^\top_2 \bv Z_2 | \cdots | {\bv X^c}^\top_J \bv Z_J]\), and
\[ N \bv G = {\bv X^c}^\top \bv Z (\bv D \otimes \bv I_J) \bv Z^\top {\bv X^c} = \sum_{j = 1}^J {\bv X^c}^\top_j \bv Z_j \bv D \bv Z^\top_j {\bv X^c}_j \]
is the cross-product matrix of \({\bv X^c}^\top \bv Z \bv u\), and \(\bv G_{kl}\) seems equal to
\[ \begin{cases} \tilde n N \bv \Sigma_{X_k Z} \bv D \bv \Sigma^\top_{X_l Z} & \text{when both }X_l \text{ and } X_k \text{ are purely level-1} \\ \tilde n N [\bv \Sigma_{X_k Z} \bv D \bv \Sigma^\top_{X_l Z} + \bv K_{X_k Z} \bv D \bv K^\top_{X_l Z}] & \text{otherwise} \end{cases} \]
where \(\tilde n = \sum_{j = 1}^J n_j^2 / N\) (reduced to \(n\) if cluster sizes are equal across clusters). So
\[ \sigma^2 ({\bv X^c}^\top \bv V^{-1} {\bv X^c})^- = \sigma^2[\bv \Sigma^{-1}_X + \tilde n \bv \Sigma^{-1}_X \bv G \bv \Sigma^{-1}_X], \]
where \(\bv G\) = \((\bv \Sigma_{X Z} \bv D \bv \Sigma^\top_{X Z} + \bv F \bv K_{X Z} \bv D \bv K^\top_{X Z} \bv F)\), \(\bv F\) is a diagonal filtering matrix in the form \(\diag[f_0, f_1, \ldots, f_{p - 1}]\), where \(f_k\) = 1 if \(X_k\) has a level-2 component and 0 otherwise.
The OLS standard error and the MLM standard error have different rates of converagence to 0
For coefficient \(\gamma_k\)
\[ \begin{aligned} \mathrm{Deff}(\hat \gamma_k) & = \frac{\{\bv \Sigma^{-1}_{X}\}_{kk} + n \left[\bv \Sigma^{-1}_X \bv G \bv \Sigma^{-1}_X\right]_{kk}}{\{\bv \Sigma^{-1}_X\}_{kk} [\Tr(\bv D \bv K_Z) + 1]} \\ & = (1 - \textrm{ICC}_D) + (1 - \textrm{ICC}_D) n \frac{\left[\bv \Sigma^{-1}_X \bv G \bv \Sigma^{-1}_X\right]_{kk}}{{\bv \Sigma^{-1}_X}_{kk}} \end{aligned} \]
Example: Growth curve modeling with Tx \(\times\) slope interaction
\[ \bv y_i = \begin{bmatrix} 1 & T_i & 0 & 0 \\ 1 & T_i & 1 & T_i \\ 1 & T_i & 2 & 2 T_i \\ 1 & T_i & 3 & 3 T_i \\ 1 & T_i & 4 & 4 T_i \\ \end{bmatrix} \begin{bmatrix} \gamma_0 \\ \gamma_1 \\ \gamma_2 \\ \gamma_3 \end{bmatrix} + \begin{bmatrix} 1 & 0 \\ 1 & 1 \\ 1 & 2 \\ 1 & 3 \\ 1 & 4 \\ \end{bmatrix} \begin{bmatrix} u_0 \\ u_1 \\ \end{bmatrix} + \begin{bmatrix} e_{i1} \\ e_{i2} \\ e_{i3} \\ e_{i4} \\ e_{i5} \\ \end{bmatrix} \]
\[ \bv \gamma = [1, 0, -0.1, -0.3]^\top, \bv D = \begin{bmatrix} 0.5 & \\ 0.2 & 0.1 \end{bmatrix}, \sigma^2 = 1.5 \]
icc_d r2_GLMM
0.655 0.056
Example cont’d
# Design effect
sigmaxz <- sigmax[, c(1, 3)]
Kxz <- Kx[, c(1, 3)]
F_mat <- diag(c(0, 1, 0, 1)) # filtering
G_mat <- (sigmaxz %*% D_mat %*% t(sigmaxz)) +
F_mat %*% Kxz %*% D_mat %*% t(Kxz) %*% F_mat
sigmax_inv <- MASS::ginv(sigmax)
(1 - icc) * (1 + num_obs * diag(sigmax_inv %*% G_mat %*% sigmax_inv) /
diag(sigmax_inv))
[1] NaN 0.6321839 0.6896552 0.6896552
For \(H_0\): \(\gamma_k = 0\)
If you have any suggestions or feedback, please email me at hokchiol@usc.edu
Multicollinearity with Crossed Random Effects
\[ \bv y = \bv X \bv \gamma + \bv Z_A \bv \tau_A + \bv Z_B \bv \tau_B + \epsilon \]
3 x 10 sparse Matrix of class "dgCMatrix"
a 2 2 2 2 2 2 2 2 2 2
b 2 2 2 2 2 2 2 2 2 2
c 2 2 2 2 2 2 2 2 2 2
3 x 10 Matrix of class "dgeMatrix"
A B C D E F G H I J
a 0 0 0 0 0 0 0 0 0 0
b 0 0 0 0 0 0 0 0 0 0
c 0 0 0 0 0 0 0 0 0 0
(Unconditional) ICC and \(R^2\)
From a random-intercepts model without fixed-effect predictors,
ICC = maximum \(R^2\) for a level-2 predictor
1 - ICC = maximum \(R^2\) for a purely level-1 predictor
(Conditional) ICC and \(R^2\)
From a conditional model with fixed-effect predictors,
ICC = Proportion of variance accounted for by level-2 random effects
\(R^2\) = Proportion of variance accounted for by all fixed-effect predictors
With covariates \(\bv X_2\), \(Y_{ij} = T_j \gamma_1 + \bv x^\top_{2ij} \bv \gamma_2 + Z_{0j} u_{0j} + e_{ij}\)
\[ \delta = \frac{\gamma_1}{\sqrt{\bv \gamma_2^\top \bv \Sigma_{X_2} \bv \gamma_2 + \tau^2_0 + \sigma^2}} \]
With random slopes, \(Y_{ij} = T_j \gamma_1 + \bv x^\top_{2ij} \bv \gamma_2 + \bv z^\top_{ij} \bv u_j + e_{ij}\)
\[ \delta = \frac{\gamma_1}{\sqrt{\bv \gamma_2^\top \bv \Sigma_{X_2} \bv \gamma_2 + \sigma^2[\Tr(\bv D \bv K_Z) + 1]}} \]
Code example (data)
Code example (cont’d)
library(lme4)
# Fit MLM
m1 <- lmer(y ~ treat + x2 + (x2 | clus_id), data = sim_data)
# Variance by x2
Sigma_x <- with(sim_data, { x2c <- x2 - mean(x2); mean(x2c^2) })
va_x2 <- Sigma_x * fixef(m1)[["x2"]]^2
# Variance by random intercepts and random slopes
# Using parameterization in lme4
Kz <- crossprod(cbind(1, sim_data$x2)) / nrow(sim_data)
va_z <- sum(VarCorr(m1)$clus_id * Kz) # Tr(Tau, Kz)
# Show all components
c(gamma_1 = fixef(m1)[["treat"]], va_x2 = va_x2,
va_z = va_z, va_e = sigma(m1)^2)
gamma_1 va_x2 va_z va_e
0.257714138 0.001712517 0.537828861 0.989420368
[1] 0.2084203