herit_loci {simtrait}R Documentation

Per-locus heritability contribution from allele frequency and causal coefficient

Description

Calculates the vector of per-locus heritability values, with each causal locus i calculated as h_i^2 = 2 * p_i * ( 1 - p_i ) * beta_i^2 / sigma_sq, where p_i is the ancestral allele frequency, beta_i is the causal coefficient, and sigma_sq is the trait variance scale. These are all assumed to be true parameters (not estimated). These per-locus heritabilities equal per-locus effect sizes divided by sigma_sq.

Usage

herit_loci(p_anc, causal_coeffs, causal_indexes = NULL, sigma_sq = 1)

Arguments

p_anc

The ancestral allele frequency vector.

causal_coeffs

The vector of causal coefficients.

causal_indexes

The optional vector of causal indexes. If NULL (default), p_anc and causal_coeffs are assumed to be for causal loci only (must be the same length). If non-NULL, causal_loci is used to subset both p_anc and causal_coeffs as needed: if each of these vectors is longer than causal_loci, then it is subset; otherwise they must have equal lengths as causal_loci or an error is thrown.

sigma_sq

The parametric variance factor of the trait (default 1). This factor corresponds to the variance of an outbred individual.

Value

The vector of per-locus heritability contributions. The sum of these values gives the overall heritability. This value can be greater than one (or wrong, more generally) if sigma_sq is misspecified.

See Also

sim_trait() generates random traits by drawing causal loci and their coefficients to fit a desired heritability. cov_trait() calculates the covariance structure of the random traits.

Examples

# create toy random data
m_loci <- 10
# ancestral allele frequencies
p_anc <- runif( m_loci )
# causal loci
causal_coeffs <- rnorm( m_loci ) / m_loci
# resulting heritability contributions vector
herit_loci( p_anc, causal_coeffs )


[Package simtrait version 1.1.3 Index]