# NOT RUN {
#Example 1
# calc BLUE for 1-level LME model,
# with covariates X, Z: (1,t), t=1,2,3
# for both fixed and random effects,
# with fixed effect coefficients B: (100,-0.5),
# random effect variance D: (2 1;1 2),
# residual variance R: 0.2
B <- matrix(c(100,-0.5),2,1)
D <- matrix(c(2,1,1,2),2,2)
R <- 0.2
X <- cbind(rep(1,3),1:3)
Z <- X
lme.Lb.dist.theta(B,D,R,X,Z)
#Example 2
# calc BLUE for 3-levels LME model,
# with level 1 same as the above example
# with 3 repeated-measures in level 2
# and 5 repeated-measures in the highest level,
# assuming random effect variance for level 2 = (3 1;1 3),
# and random effect variance for highest level = (5 1;1 5)
D <- list(matrix(c(2,1,1,2),2,2),matrix(c(3,1,1,3),2,2), matrix(c(5,1,1,5),2,2))
lme.Lb.dist.theta(B,D,R,X,Z,m=c(5,3))
# }
Run the code above in your browser using DataLab