Description Usage Arguments Details Value Author(s) References Examples
This function fits a mixed model. See details section.
1 2 3 4 5 |
y |
(numeric, n) the data-vector (NAs not allowed). |
X |
numeric incidence matrix for fixed effects, dimmension n x c (NAs not allowed). |
Z |
numeric incidence matrix for random effects, dimmension n x q (NAs not allowed). |
A |
numeric matrix for modelling covariance for y, for example in the animal model it can be a numeric relationship matrix derived from a pedigree. Dimmension n x n. |
d |
eigenvalues for G matrix. G = ZAZ'=UDU'. |
U |
eigenvector for G matrix. G = ZAZ'=UDU'. |
BLUE |
logical, if TRUE the BLUPs are computed. |
BLUP |
logical, if TRUE the BLUPs are computed. |
method |
estimation method for the variance components, can be maximum likelihood or restricted maximum likelihood. The detault is "ML" and is the only one implemented now. |
lambda_ini |
Initial value for varU/varE. |
tol |
tiny real number for declaring convergence. |
maxiter |
integer number for specifying the number of iterations. |
This function fits a mixed model
y=X*Beta + Z*u + e
where y is the vector of phenotypes, X is the matrix for FIXED EFFECTS, Z matrix connection phenotypes and genotypes, u ~ N(0, varU*A), A a genomic relationship matrix or pedigree and e~ N(0, varE*I).
The model is fitted using the algorithm described in Zhou and Stephens, 2012.
A list with the following components:
varE |
varE. |
varU |
varU. |
Beta |
Beta. |
u |
u. |
message |
string that informs if the method converged or not. |
method |
method used for computing variance components. |
Paulino Perez, Gustavo de los Campos
Zhou, X. and Stephens, Matthew. 2012. Genome-wide efficient mixed-model analysis for association studies. Nature Genetics. 47(7) 821-824.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ## Not run:
library(BGLR)
library(BGLRutils)
setwd(tempdir())
#Examples
#1) Wheat dataset
data(wheat)
A=wheat.A
y=wheat.Y[,1]
ETA=list(list(K=A,model="RKHS"))
set.seed(123)
fm=BGLR(y=y,ETA=ETA,nIter=5000)
#fm_mixed=fitMixed(y,A=A)
out=eigen(A)
fm_mixed=fitMixed(y=y,A=A,d=out$values,U=out$vectors)
plot(fm$ETA[[1]]$u,fm_mixed$u)
cat("fm_mixed$varE=",fm_mixed$varE,"\n")
cat("fm$varE=",fm$varE,"\n")
cat("fm_mixed$varU=",fm_mixed$varU,"\n")
cat("fm$ETA[[1]]$varU=",fm$ETA[[1]]$varU,"\n")
#mouse dataset
data(mouse)
A=mouse.A
y=mouse.pheno$Obesity.BMI
ETA=list(list(K=A,model="RKHS"))
set.seed(123)
fm=BGLR(y=y,ETA=ETA,nIter=5000)
#fm_mixed=fitMixed(y,A=A)
out=eigen(A)
fm_mixed=fitMixed(y=y,A=A,d=out$values,U=out$vectors)
plot(fm$ETA[[1]]$u,fm_mixed$u)
cat("fm_mixed$varE=",fm_mixed$varE,"\n")
cat("fm$varE=",fm$varE,"\n")
cat("fm_mixed$varU=",fm_mixed$varU,"\n")
cat("fm$ETA[[1]]$varU=",fm$ETA[[1]]$varU,"\n")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.