The `gvc` class calculates genotypic variance, phenotypic variance, and broad-sense heritability from replicated data.
Details
The `gvc` class uses methods explained by Burton, G. W. & Devane, E. H. (1953) and Allard, R.W. (2010). It includes methods for calculating genetic variance, phenotypic variance, and heritability.
Public fields
dataA `tibble` containing the data for analysis.
yThe name of the response variable.
xThe name of the covariate (optional).
repThe name of the replicate factor.
genThe name of the genotype factor.
envThe name of the environmental factor.
Methods
Method new()
Initialize the `gvc` class with the data and variable names.
Usage
gvc$new(.data, .y, .x = NULL, .rep, .gen, .env)Examples
df1 <- data.frame(
Response = c(
rnorm(48, mean = 15000, sd = 500)
, rnorm(48, mean = 5000, sd = 500)
, rnorm(48, mean = 1000, sd = 500)
)
, Rep = as.factor(rep(1:3, each = 48))
, Variety = gl(n = 4, k = 4, length = 144, labels = letters[1:4])
, Env = gl(n = 3, k = 16, length = 144, labels = letters[1:3])
)
# Create an instance of the class
gvc1 <- gvc$new(
.data = df1
, .y = Response
, .rep = Rep
, .gen = Variety
, .env = Env
)
# Calculate genetic variance (gvar)
gvc1$calculate_gvar()
#> boundary (singular) fit: see help('isSingular')
#> $gvar
#> [1] 1.392268e-11
#>
# Calculate phenotypic variance (pvar)
gvc1$calculate_pvar()
#> boundary (singular) fit: see help('isSingular')
#> $pvar
#> [1] 319911.6
#>
# Calculate heritability (h2)
gvc1$calculate_herit()
#> boundary (singular) fit: see help('isSingular')
#> $h2
#> [1] 4.35204e-17
#>