# NOT RUN {
data(CPdata)
head(CPpheno)
CPgeno[1:4,1:4]
#### create the variance-covariance matrix 
A <- A.mat(CPgeno)
#### look at the data and fit the model
head(CPpheno)
#### create a customized incidence matrix
Zr <- model.matrix(~Rowf-1, CPpheno); dim(Zr)
Kr <- diag(ncol(Zr));
colnames(Kr) <- rownames(Kr) <- colnames(Zr)
mix1 <- mmer2(Yield~1,
              random=~ Colf + grp(Rowf), 
              rcov=~units,
              grouping=list(Rowf=Zr),
              G=list(Rowf=Kr),
              data=CPpheno)
summary(mix1)
# mix2 <- mmer2(cbind(color,Yield)~1,
#               random=~diag(trait):Colf + us(trait):grp(g(Rowf)), 
#               rcov=~us(trait):units,
#               grouping=list(Rowf=Zr),
#               G=list(Rowf=Kr),
#               data=CPpheno)
# summary(mix2)
# }
Run the code above in your browser using DataLab