# R code for the example with a QTL affecting a specific quantitative trait y<-matrix(c(95.9, 108.0, 96.5, 92.9, 101.0, 94.5, 93.7, 89.8, 101.2, 103.9, 85.9, 109.4, 105.7, 98.4, 84.1, 103.1, 117.1, 95.2, 106.4, 104.7, 92.5, 123.9, 97.8, 100.5),nrow=24) X<-matrix(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1), nrow=24) b <- solve(t(X) %*% X) %*% t(X) %*% y # Using package lm qtl <- X[,2] plot(qtl,y) reg <- lm(y ~ qtl) summary(reg) library(multcomp) m1 <- lm(y ~ 0 + factor(qtl)) summary(m1) # Contrast for additive effect K<-matrix(c(-0.5,0,0.5),1) t<-glht(m1, linfct = K) summary(t) # Contrast for dominance effect K<-matrix(c(-0.5,1,-0.5),1) t<-glht(m1, linfct = K) summary(t)