MME: Mixed Model Equations

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/MME.r

Description

Set up Mixed Model Equations for given design matrices, i.e. variance components for random effects must be known.

Usage

1
MME(X, Z, GI, RI, y)

Arguments

X

Design matrix for fixed effects

Z

Design matrix for random effects

GI

Inverse of (estimated) variance-covariance matrix of random (genetic) effects multplied by the ratio of residual to genetic variance

RI

Inverse of (estimated) variance-covariance matrix of residuals (without multiplying with a constant, i.e. sigma2e)

y

Vector of phenotypic records

Details

The linear mixed model is given by

y = Xb + Zu +e

with u = N(0,G) and e = N(0,R). Solutions for fixed effects b and random effects u are obtained by solving the corresponding mixed model equations (Henderson, 1984)

(X'RIX,X'RIZ,Z'RIX,ZRIZ+GI)(bhat,uhat)=(X'RIy,Z'RIy)

Matrix on left hand side of mixed model equation is denoted by LHS and matrix on the right hand side of MME is denoted as RHS. Generalized Inverse of LHS equals prediction error variance matrix. Square root of diagonal values multiplied with sigma2e equals standard error of prediction. Note that variance components for fixed and random effects are not estimated by this function but have to be specified by the user, i.e. GI must be multiplied with shrinkage factor sigma2e/sigma2g.

Value

A list with the following arguments

b

Estimations for fixed effects vector

u

Predictions for random effects vector

LHS

left hand side of MME

RHS

right hand side of MME

C

Generalized inverse of LHS. This is the prediction error variance matrix

SEP

Standard error of prediction for fixed and random effects

SST

Sum of Squares Total

SSR

Sum of Squares due to Regression

residuals

Vector of residuals

Author(s)

Valentin Wimmer

References

Henderson, C. R. 1984. Applications of Linear Models in Animal Breeding. Univ. of Guelph, Guelph, ON, Canada.

See Also

regress, crossVal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
library(synbreedData)
data(maize)

# realized kinship matrix
maizeC <- codeGeno(maize)
U <- kin(maizeC, ret = "realized") / 2

# solution with gpMod
m <- gpMod(maizeC, kin = U, model = "BLUP")

# solution with MME
diag(U) <- diag(U) + 0.000001 # to avoid singularities
# determine shrinkage parameter
lambda <- m$fit$sigma[2] / m$fit$sigma[1]
# multiply G with shrinkage parameter
GI <- solve(U) * lambda
y <- maizeC$pheno[, 1, ]
n <- length(y)
X <- matrix(1, ncol = 1, nrow = n)
mme <- MME(y = y, Z = diag(n), GI = GI, X = X, RI = diag(n))

# comparison
head(m$fit$predicted[, 1] - m$fit$beta)
head(mme$u)

## End(Not run)

synbreed documentation built on March 12, 2021, 3:01 a.m.