solveMme: Solve MME

solveMmeR Documentation

Solve MME

Description

Given T=1 response, P fixed effects and Q random variables (for a total of N observations), compute the BLUEs and BLUPs of the following linear mixed model by solving Henderson's mixed model equation (MME): y = X beta + Z u + epsilon, where y is N x 1; X is N x P; Z is N x Q; u ~ Normal_Qx1(0, sigma_u^2 A); epsilon ~ Normal_Nx1(0, sigma^2 Id_N).

Usage

solveMme(y, X, Z, sigma.u2, Ainv, sigma2)

Arguments

y

vector of responses (or matrix with one column)

X

incidence matrix of fixed effects

Z

incidence matrix of random variables

sigma.u2

variance component of the random variables

Ainv

inverse of A, the variance-covariance matrix of the random variables

sigma2

variance component of the errors

Value

vector of length PQ containing the BLUEs of beta and the BLUPs of u

Author(s)

Timothee Flutre

See Also

makeMmeElements, makeMmeRhs, makeMmeLhs

Examples

## Not run: ## simulate genotypes
set.seed(1859)
X <- simulGenosDose(nb.genos=200, nb.snps=2000)

## estimate the additive genetic relationships
A <- estimGenRel(X, relationships="additive", method="vanraden1", verbose=0)

## simulate phenotypes
model <- simulAnimalModel(T=1, Q=3, A=A, V.G.A=15, V.E=5, seed=1859)

## calculate BLUEs and BLUPs
if(isSingular(A)){
   Ainv <- mpInv(A)
} else
   Ainv <- solve(A)
fit <- solveMme(y=model$Y[,1,drop=FALSE], X=model$W, Z=model$Z,
                sigma.u2=model$V.G.A, Ainv=Ainv, sigma2=model$V.E)
cbind(model$C, fit[1:3])
cor(model$G.A, fit[4:length(fit)])

## End(Not run)

timflutre/rutilstimflutre documentation built on Aug. 18, 2024, 7:43 p.m.