# Solved – Covariance structure for random intercepts and slopes

Can you please help me figuring out what the covariance structure of a model with random intercept and random slope is?

Here is my model \$Y_{ij} = beta_0 + beta_1 t_{ij} + b_{0,i} + b_{1,i}t_{ij} + e_{ij}\$

where \$b_{0,i}\$ and \$b_{1,i}\$ are random intercept and random slope and we know that \$e_{ij}\$ are mutually independent and also:

\$b_i\$ ~ \$N(0,D)\$ where \$b_i = (b_{0,i},b_{1,i})\$ and \$e_{ij}\$ ~ \$N(0,sigma^2)\$

Contents

Using the properties of the covariance operator we have

\$\$\$\$

\$\$begin{align*} textrm{Cov}(Y_{ij}, Y_{ik}) & = textrm{Cov}(beta_0 + beta_1 t_{ij} + b_{0i} + b_{1i} t_{ij} + e_{ij}, ; beta_0 + beta_1 t_{ik} + b_{0i} + b_{1i} t_{ik} + e_{ik}) \ & = textrm{Cov}(b_{0i} + b_{1i} t_{ij} + e_{ij}, ; b_{0i} + b_{1i} t_{ik} + e_{ik}) \ & = textrm{Cov}(b_{0i}, ; b_{0i}) + t_{ik} , textrm{Cov}(b_{0i}, ; b_{1i}) + textrm{Cov}(b_{0i}, ; e_{ik}) \ & quad +, t_{ij} , textrm{Cov}(b_{1i}, ; b_{0i}) + t_{ij} t_{ik} , textrm{Cov}(b_{1i}, ; b_{1i}) + t_{ij} , textrm{Cov}(b_{1i}, ; e_{ik}) \ & quad +, textrm{Cov}(e_{ij}, ; b_{0i}) + t_{ik} , textrm{Cov}(e_{ij}, ; b_{1i}) + textrm{Cov}(e_{ij}, ; e_{ik}) \ & = textrm{Var}(b_{0i}) +, (t_{ij} + t_{ik}) textrm{Cov}(b_{0i}, ; b_{1i}) +, t_{ij}t_{ik} textrm{Var}(b_{1i}) +, textrm{Cov}(e_{ij}, ; e_{ik}) end{align*}\$\$

\$\$\$\$

If \$j neq k\$, then \$\$begin{align*} textrm{Cov}(Y_{ij}, Y_{ik}) & = textrm{Var}(b_{0i}) + (t_{ij} + t_{ik}) , textrm{Cov}(b_{0i}, ; b_{1i}) + t_{ij} t_{ik} textrm{Var}(b_{1i}) end{align*}\$\$

If \$j = k\$, then \$\$begin{align*} textrm{Cov}(Y_{ij}, Y_{ik}) & = textrm{Var}(Y_{ij}) \ & = textrm{Var}(b_{0i}) + 2 , t_{ij} , textrm{Cov}(b_{0i}, ; b_{1i}) + t_{ij}^2 textrm{Var}(b_{1i}) + sigma^2 end{align*}\$\$

\$\$\$\$

\$textrm{Var}(b_{0i})\$, \$textrm{Var}(b_{1i})\$, and \$textrm{Cov}(b_{0i}, ; b_{1i})\$ are found in your matrix \$D\$.

Rate this post