lmerUvcov {lme4GS} | R Documentation |
Fits a linear mixed model with user specified variance covariance-matrices.
Description
Fits a linear mixed model with user specified variance covariance-matrices.
Usage
lmerUvcov(formula, data = NULL, Uvcov = NULL,verbose=0L)
Arguments
formula |
a two-sided linear formula object describing both the fixed-effects and random-effects part of the model, with the response on the left of a ‘~’ operator and the terms, separated by ‘+’ operators, on the right. Random-effects terms are distinguished by vertical bars (‘|’) separating expressions for design matrices from grouping factors. |
data |
an optional data frame containing the variables named in ‘formula’. |
Uvcov |
list. |
verbose |
integer scalar, verbose output from optimizeLmer function?. If '> 0' verbose output is generated during the optimization of the parameter estimates, default value is 0L. |
Details
The routine fits the linear mixed model:
y=Xβ + Z1 u1 + ... + Zq uq + e,where \boldsymbol y
is the response vector, \boldsymbol X
is the matrix for
fixed effects, β is the vector of fixed effects,
Zj is a design matrix for random effects,
uj is a vector of random effects,
j=1,\dots,q
. We assume that
uj~N(0,σ2j K j),
j=1,\dots,q
and
e~N(0,σ2eI).
The linear mixed model can be re-written as:
y=Xβ + Z1* u1*+...+Zq* uq*+e,where Zj*=Zj Lj, with Lj from Cholesky factorization for Kj. Alternatively, Zj*=ZjΓjΛ1/2, with Γj and Λj the matrix of eigen-vectors and eigen-values obtained from the eigen-value decomposition for Kj. The factorization method for Kj is selected automatically at runtime.
Value
An object of class merMod (more specifically,
an object of subclass lmerMod
), for which many methods
are available (e.g. methods(class="merMod")
)
Author(s)
Paulino Perez-Rodriguez
References
Caamal-Pat D., P. Perez-Rodriguez, J. Crossa, C. Velasco-Cruz, S. Perez-Elizalde, M. Vazquez-Pena. 2021. lme4GS: An R-Package for Genomic Selection. Front. Genet. 12:680569. doi: 10.3389/fgene.2021.680569 doi: 10.3389/fgene.2021.680569
Examples
library(BGLR)
library(lme4GS)
########################################################################
#Example wheat
########################################################################
data(wheat)
X<-wheat.X
Z<-scale(X,center=TRUE,scale=TRUE)
G<-tcrossprod(Z)/ncol(Z)
A<-wheat.A
rownames(G)<-colnames(G)<-rownames(A)
y<-wheat.Y[,1]
data<-data.frame(y=y,m_id=rownames(G),a_id=rownames(A))
fm1<-lmerUvcov(y~(1|m_id)+(1|a_id),data=data,
Uvcov=list(m_id=list(K=G),a_id=list(K=A)))
summary(fm1)
#Predictions
plot(y,predict(fm1))
#Random effects
ranef(fm1)