herit_boot: Heritability confidence interval by bootstrap

Description Usage Arguments Details Value

View source: R/herit_boot.R

Description

Heritability confidence interval by bootstrap

Usage

1
2
3
4
5
herit_boot(object, ...)

## S3 method for class 'lmerMod'
herit_boot(object, exp, boot.reps = 1000,
  alpha = 0.05, ...)

Arguments

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, but may not be found in object. For instance, if the argument exp = "geno / (geno + (Residual / r))" was passed, you would also pass the argument r = 2.

exp

A quoted expression used to calculate the heritability. For instance, "geno / (geno + (Residual / r))".

boot.reps

The number of bootsrap replicates.

alpha

The significance level for the confidence interval.

Details

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.

Value

A data.frame with the following values:

heritability

The estimate of the heritability using the original data.

se

The standard error of the estimate, calculated as the standard deviation among the bootstrap replicates.

bias

The bias of the original heritability estimate, calculated as the difference between the mean of the bootstrapped estimates and the original estimate.

ci_lower

The lower limit of the confidence interval.

ci_upper

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)


neyhartj/pbr documentation built on Jan. 7, 2020, 9:24 a.m.