Learn R Programming

gaston (version 1.4.9)

lmm.diago: Linear mixed model fitting with the diagonalization trick

Description

Estimate the parameters of a linear mixed model, using the "diagonalization trick".

Usage

lmm.diago(Y, X = matrix(1, nrow=length(Y)), eigenK, p = 0, tol = .Machine$double.eps^0.25)

Arguments

Y
Phenotype vector
X
Covariable matrix
eigenK
Eigen decomposition of $K$ (a positive symmetric matrix)
p
Number of Principal Components included in the mixed model with fixed effect
tol
Accuracy of estimation (parameter for optimize)

Value

If the parameter p is a scalar, a list with following elements :If the paramer p is a vector of length > 1, a list of lists as described above, one for each value in p.

Details

Estimate the parameters of the following linear mixed model, computing the likelihood as in lmm.diago.likelihood, and using the optimization algorithm of the R base function optimize: $$ Y = (X|PC)\beta + \omega + \varepsilon $$ with $omega ~ N(0, tau K)$ and $epsilon ~ N(0, sigma^2 I_n)$.

The matrix $K$ is given through its eigen decomposition, as produced by eigenK = eigen(K, symmetric = TRUE). The matrix $(X|PC)$ is the concatenation of the covariable matrix $X$ and of the first $p$ eigenvectors of $K$, included in the model with fixed effects.

See Also

lmm.diago.likelihood, lmm.aireml, optimize

Examples

Run this code
# Load data
data(AGT)
x <- as.bed.matrix(AGT.gen, AGT.fam, AGT.bim)

# Compute Genetic Relationship Matrix
K <- GRM(x)

# eigen decomposition of K
eiK <- eigen(K)

# simulate a phenotype
set.seed(1)
y <- 1 + lmm.simu(tau = 1, sigma2 = 2, eigenK = eiK)$y

# Estimations
R <- lmm.diago(Y = y, eigenK = eiK, p = c(0,10))
str(R)

Run the code above in your browser using DataLab