Description Usage Arguments Details Value
Heritability confidence interval by bootstrap
1 2 3 4 5 | herit_boot(object, ...)
## S3 method for class 'lmerMod'
herit_boot(object, exp, boot.reps = 1000,
alpha = 0.05, ...)
|
object |
A model object. See Details for accepted classes. |
... |
Other arguments to pass. This is generally a list of other objects
that are in |
exp |
A quoted expression used to calculate the heritability. For instance,
|
boot.reps |
The number of bootsrap replicates. |
alpha |
The significance level for the confidence interval. |
This function implements model-based bootstrapping to obtain the standard error and confidence interval around an estimate of the heritability. The function uses the original fitted model to simulate new observations using the same model parameters. The model is then re-fitted using the new observations, and the heritability is re-calculated. This is repeated n times.
See pbr
for accepted classes for herit_boot
.
A data.frame
with the following values:
The estimate of the heritability using the original data.
The standard error of the estimate, calculated as the standard deviation among the bootstrap replicates.
The bias of the original heritability estimate, calculated as the difference between the mean of the bootstrapped estimates and the original estimate.
The lower limit of the confidence interval.
The upper limit of the confidence interval.
#' # Use the gauch.soy dataset data("gauch.soy")
# Filter gauch_soy1 <- gauch.soy group_by(env) filter(n_distinct(gen, rep) == 28)
# Set the number of reps and number of environments n_r <- 4 n_e <- 36
# Fit a linear model using lm lm_mod <- lm(yield ~ gen + env + gen:env + rep
# Variance components from a fixed effects model are derived from the ANOVA table. # The function also required expressions to calculate the variance components ms.exp <- list("gen:env" = "(gen:env - Residuals) / n_r", "gen" = "(gen - gen:env) / (n_r * n_e)")
exp = "gen / (gen + (gen:env / n_e) + (Residuals / n_r))"
herit(object = lm_mod, exp = exp, ms.exp = ms.exp, n_r = n_r, n_e = n_e)
# Fit a linear model using lmer lmer_mod <- lmer(yield ~ (1|gen) + (1|env) + (1|gen:env) + (1|env:rep), data = gauch_soy1) # Calculate heritability herit(object = lmer_mod, exp = "gen / (gen + (gen:env / n_e) + (Residual / n_r))", n_r = n_r, n_e = n_e)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.