gvc | R Documentation |
The 'gvc' class calculates genotypic variance, phenotypic variance, and broad-sense heritability from replicated data.
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.
data
A 'tibble' containing the data for analysis.
y
The name of the response variable.
x
The name of the covariate (optional).
rep
The name of the replicate factor.
gen
The name of the genotype factor.
env
The name of the environmental factor.
new()
Initialize the 'gvc' class with the data and variable names.
gvc$new(.data, .y, .x = NULL, .rep, .gen, .env)
.data
A 'data.frame' containing the data for analysis.
.y
The response variable.
.x
The covariate (optional).
.rep
The replicate factor.
.gen
The genotype factor.
.env
The environmental factor.
An instance of the 'gvc' class.
calculate_gvar()
Calculate genetic variance.
gvc$calculate_gvar()
A list with the genetic variance ('gvar').
calculate_pvar()
Calculate phenotypic variance.
gvc$calculate_pvar()
A list with the phenotypic variance ('pvar').
calculate_herit()
Calculate broad-sense heritability.
gvc$calculate_herit()
A list with the heritability ('h2').
clone()
The objects of this class are cloneable with this method.
gvc$clone(deep = FALSE)
deep
Whether to make a deep clone.
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()
# Calculate phenotypic variance (pvar)
gvc1$calculate_pvar()
# Calculate heritability (h2)
gvc1$calculate_herit()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.