Learn R Programming

pass.lme (version 0.9.0)

lme.Lb.dist.theta: Calculate mean and variance for linear combination of the Best Linear Unbiased Estimator (BLUE) for Linear Mixed Effect (LME) Model

Description

Consider the following model: Y=XB+Zu+e, u~N(0,D), e~N(0,R) Yi~N(XBi,Vi), Vi=Zi*D*Zi'+Ri, for each independent observation i estimate of fixed effect coefficient B, denoted by b: b=inv(sum(Xi'*inv(Vi)*Xi))*(sum(Xi'*inv(Vi)*Yi)) variance of b: var(b)=Vb/n=inv(sum(Xi'*inv(Vi)*Xi)) where Vb=inv(Xi'*inv(Vi)*Xi) distribution of any linear combinations L of b is given by: Lb~N(mu,Sigma/n) where mu = LB, Sigma = L*Vb*L'

Usage

lme.Lb.dist.theta(B, D, R, X, Z, m = NULL, L)

Arguments

B

fixed effect beta in px1 matrix

D

list of qxq random effect variance matrix; where the first element corresponding to the highest-level effect, the last element corresponding to the level 1 effect

R

residual variance

X

nxp matrix representing the covariates for the fixed effects

Z

nxq matrix representing the covariates for each level of random effects

m

vector of repeated measures from the highest to lowest level (level 1 effects are addressed by Z and X and no need to be specified)

L

lxp matrix, representing l-linear-combinations of beta interested, if L is not defined, it will be auto-created to select the last coefficient

Value

theta: parameters (mu and Sigma) of the normal distribution for Lb

Details

Technical note

See Also

pass.lme.CLb.test

Examples

Run this code
# 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