# NOT RUN {
data(h2example)
head(h2example)
####=========================================####
#### fit the mixed model (very heavy model)
####=========================================####
# ans1 <- mmer2(y~Env,
# random=~at(Env):Name + at(Env):Block,
# rcov=~at(Env):units,
# data=h2example)
# summary(ans1)
####=========================================####
#### calculate heritability
####=========================================####
# length(levels(h2example$Env)) # number of environment
# 2 # number of blocks
# # using the pin function
# pin(ans1,h2example~(V1+(V3/15))/(V1+(V3/15)+(V5/(2*15))))
# # using the
# h2.fun(ans1, h2example, gTerm = "Name", eTerm = "Env")
# }
Run the code above in your browser using DataLab