####=========================================####
#### 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_technow)
DT <- DT_technow
Md <- Md_technow
Mf <- Mf_technow
# Md <- (Md*2) - 1
# Mf <- (Mf*2) - 1
# Ad <- A.mat(Md)
# Af <- A.mat(Mf)
# ###=========================================####
# ###=========================================####
# ans2 <- mmes(GY~1,
# random=~vsm(ism(dent),Gu=Ad) + vsm(ism(flint),Gu=Af),
# rcov=~units,
# data=DT)
# summary(ans2)$varcomp
#
# Adi <- solve(Ad + diag(1e-4,ncol(Ad),ncol(Ad)))
# Adi <- as(as(as( Adi, "dMatrix"), "generalMatrix"), "CsparseMatrix")
# Afi <- solve(Af + diag(1e-4,ncol(Af),ncol(Af)))
# Afi <- as(as(as( Afi, "dMatrix"), "generalMatrix"), "CsparseMatrix")
# ####====================####
# #### multivariate model ####
# #### 2 traits ####
# ####====================####
# head(DT)
# DT2 <- stackTrait(DT, traits = c("GY","GM"))
# head(DT2$long)
#
# M <- rbind(Md,Mf)
# A <- A.mat(M)
# Ai <- solve(A + diag(1e-4,ncol(A),ncol(A)))
# Ai <- as(as(as( Ai, "dMatrix"), "generalMatrix"), "CsparseMatrix")
# DT2$long=DT2$long[with(DT2$long, order(trait)), ]
#
# ans3 <- mmes(valueS~trait, henderson=TRUE,
# random=~vsm(usm(trait),ism(overlay(dent,flint)),Gu=Ai),
# rcov=~ vsm(dsm(trait), ism(units)),
# data=DT2$long)
# summary(ans3)
# cov2cor(ans3$theta[[1]])
Run the code above in your browser using DataLab