Learn R Programming

sommer (version 2.9)

h2: Broad sense heritability calculation.

Description

This dataset contains phenotpic data for 41 potato lines evaluated in 5 locations across 3 years in an RCBD design. The phenotypic trait is tuber quality and we show how to obtain an estimate of h2 for the trait.

Usage

data("h2")

Arguments

Format

The format is: chr "h2"

References

Covarrubias-Pazaran G (2016) Genome assisted prediction of quantitative traits using the R package sommer. PLoS ONE 11(6): doi:10.1371/journal.pone.0156744

See Also

The core functions of the package mmer and mmer2

Examples

Run this code
# NOT RUN {
####=========================================####
#### For CRAN time limitations most lines in the 
#### examples are silenced with one '#' mark, 
#### remove them and run the examples
####=========================================####
data(h2)
head(h2)
####=========================================####
#### fit the mixed model and extract var.comp
####=========================================####
#ans1 <- mmer2(y~1, random=~Name + Env + Name:Env + Block,data=h2, method="NR")
#vc <- ans1$var.comp
#V_E <- vc[2,1];V_GE <- vc[3,1];V_G <- vc[1,1];Ve <- vc[5,1]
####=========================================####
#### calculate heritability
####=========================================####
#n.env <- length(levels(h2$Env))
#h2c <- V_G/(V_G + V_GE/n.env + Ve/(2*n.env)) #the 2 is a reference for block#
#h2c

####=========================================####
####=========================================####
#### using the 'mmer' function would be fitted as
####=========================================####
####=========================================####
#data(h2)
#Y <- h2$y
#Z1 <- model.matrix(~Name-1,data=h2)
#Z2 <- model.matrix(~Env-1,data=h2)
#Z3 <- model.matrix(~Name:Env-1,data=h2)
#Z4 <- model.matrix(~Block-1,data=h2)
#ETA <- list(Name=list(Z=Z1),
#            Env=list(Z=Z2),
#            Name.Env=list(Z=Z3),
#            Block=list(Z=Z4))

#ans1 <- mmer(Y=Y,Z=ETA)
#vc <- ans1$var.comp
#V_E <- vc[2,1];V_GE <- vc[3,1];V_G <- vc[1,1];Ve <- vc[5,1]
#n.env <- length(levels(h2$Env))
#h2c <- V_G/(V_G + V_GE/n.env + Ve/(2*n.env)) #the 2 is a reference for block#
#h2c
# }

Run the code above in your browser using DataLab