# NOT RUN {
####=========================================####
#### For CRAN time limitations most lines in the
#### examples are silenced with one '#' mark,
#### remove them and run the examples
####=========================================####
data(HDdata)
head(HDdata)
####=========================================####
#### GCA matrix for half diallel using male and female columns
#### use the 'hdm' function to create the half diallel matrix
####=========================================####
Z1 <- overlay(HDdata[,c("male","female")])
####=========================================####
#### SCA matrix
####=========================================####
Z2 <- model.matrix(~as.factor(geno)-1, data=HDdata)
####=========================================####
#### Define response variable and run
####=========================================####
y <- HDdata$sugar
ETA <- list(GCA=list(Z=Z1), SCA=list(Z=Z2)) # Zu component
modHD <- mmer(Y=y, Z=ETA)
summary(modHD)
####=========================================####
#### Example 2
#### using overlay with mmer2 function
####=========================================####
# data(HDdata)
# head(HDdata)
# HDdata$female <- as.factor(HDdata$female)
# HDdata$male <- as.factor(HDdata$male)
# HDdata$geno <- as.factor(HDdata$geno)
# #### model using overlay
# modh <- mmer2(sugar~1, random=~female + and(male) + geno,
# data=HDdata)
# summary(modh)
# #### model using overlay [and(.)] and covariance structures [g(.)]
# A <- diag(7); A[1,2] <- 0.5; A[2,1] <- 0.5 # fake covariance structure
# colnames(A) <- as.character(1:7); rownames(A) <- colnames(A);A
#
# modh2 <- mmer2(sugar~1, random=~g(female) + and(g(male)) + geno,
# G=list(female=A, male=A),data=HDdata)
# summary(modh2)
# }
Run the code above in your browser using DataLab