####=========================================####
#### For CRAN time limitations most lines in the
#### examples are silenced with one '#' mark,
#### remove them and run the examples using
#### command + shift + C |OR| control + shift + C
####=========================================####
# data(DT_wheat)
# DT <- DT_wheat
# GT <- GT_wheat
# DTlong <- data.frame(pheno=as.vector(DT),
# env=sort(rep(1:4,nrow(DT))),
# id=rep(rownames(DT),4))
# DT <- as.data.frame(DT);colnames(DT) <- paste0("x",1:4);DT$line <- rownames(DT);
# rownames(GT) <- DT$line
# K <- A.mat(GT) # additive relationship matrix
# K[1:4,1:4]
# ###=========================================####
# ###=========================================####
# ### using formula based 'mmes'
# ###=========================================####
# ###=========================================####
# head(DT)
# #### univariate
# mix0 <- mmes(x1~1,
# random = ~vsm(ism(line),Gu=K),
# rcov=~units,
# data=DT)
# summary(mix0)$varcomp
# # if using mmes=TRUE provide Gu as inverse
# Ki <- solve(K + diag(1e-4,ncol(K),ncol(K)))
# Ki <- as(as(as( Ki, "dMatrix"), "generalMatrix"), "CsparseMatrix")
Run the code above in your browser using DataLab