# ####=========================================####
# ####=========================================####
# #### EXAMPLE 1
# #### simple example with univariate models
# ####=========================================####
# ####=========================================####
# data("DT_cpdata")
# DT <- DT_cpdata
# GT <- GT_cpdata
# MP <- MP_cpdata
# #### create the variance-covariance matrix
# A <- A.mat(GT)
# #### look at the data and fit the model
# head(DT)
# ans.m <- mmer(cbind(Yield,color,FruitAver, Firmness)~1,
# random=~ vsr(id, Gu=A, Gtc=unsm(4))
# + vsr(Rowf,Gtc=diag(4))
# + vsr(Colf,Gtc=diag(4)), na.method.Y="include",
# rcov=~ vsr(units,Gtc=unsm(4)), return.param = TRUE,
# data=DT)
#
# # define the number of cores (number of bivariate models) as (nt*(nt-1))/2
# nt=4
# (nt*(nt-1))/2
# res <- bivariateRun(ans.m,n.core = 6)
# # now use the variance componets to fit a join model
# mm <- transformConstraints(ans.m[[8]],3)
#
# ans.m.final <- mmer(cbind(Yield,color,FruitAver, Firmness)~1,
# random=~ vsr(id, Gu=A, Gtc=unsm(4))
# + vsr(Rowf,Gtc=diag(4))
# + vsr(Colf,Gtc=diag(4)), na.method.Y="include",
# rcov=~ vsr(units,Gtc=unsm(4)),
# init = res$sigmas_scaled, constraints = mm,
# data=DT, iters=1)
#
# summary(ans.m.final)
Run the code above in your browser using DataLab