if (FALSE) {
library(agridat)
data(hadasch.lettuce)
data(hadasch.lettuce.markers)
dat <- hadasch.lettuce
datm <- hadasch.lettuce.markers
libs(agridat)
# loc 1 has 2 reps, loc 3 has higher dmr
dotplot(dmr ~ factor(gen)|factor(loc), dat,
group=rep, layout=c(1,3),
main="hadasch.lettuce")
# kinship matrix
# head( tcrossprod(as.matrix(datm[,-1])) )
if(require("asreml", quietly=TRUE)){
libs(asreml)
dat <- transform(dat, loc=factor(loc), gen=factor(gen), rep=factor(rep))
m1 <- asreml(dmr ~ 1 + gen, data=dat,
random = ~ loc + gen:loc + rep:loc)
p1 <- predict(m1, classify="gen")$pvals
}
libs(sommer)
m2 <- mmer(dmr ~ 0 + gen, data=dat,
random = ~ loc + gen:loc + rep:loc)
p2 <- coef(m2)
head(p1)
head(p2)
}
Run the code above in your browser using DataLab