generate_bio_pleiotrophy_effects: Get correlated effects for a pair of traits.

Description Usage Arguments Value Examples

View source: R/assortative_mating_functions.R

Description

The genotype effects consist of the effect for each locus, which is drawn from a Normal(0,1) distribution for each locus and the genetic standard deviation of that trait which is the standard deviation for each trait normalised by the allele frequency.

Usage

1
generate_bio_pleiotrophy_effects(loci, allele_freq, corr_coeff, env_var)

Arguments

loci

A vector with the loci affecting the traits

allele_freq

The allele frequency of sampled loci. A vector at least as long as max loci specified.

corr_coeff

The correlation coefficient between traits

env_var

The environmental variance. Either one value shared by both traits or a vector of length 2.

Value

A a list with effects_A and effects_B

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
f <- runif(1000, 0.05, 0.5)
pleio <- generate_bio_pleiotrophy_effects(1:1000, f, 0.4, env_var = c(1,1))
plot(pleio$effects_A$effects, pleio$effects_B$effects, xlab="Effect of locus on trait A", ylab="Effect of locus on trait B")
cor(pleio$effects_A$effects, pleio$effects_B$effects)
g <- sample_initial_genotypes(1000, f)
## generate phenotypes from the model
phenoA <- generate_phenotype(pleio$effects_A, g)
phenoB <- generate_phenotype(pleio$effects_B, g)
## correlation between phenotypes
cor(phenoA$pheno, phenoB$pheno)
## correlation between additive genetic effects
cor(phenoA$additive_genetic, phenoB$additive_genetic)

ijwilson/gencorram documentation built on Dec. 20, 2021, 6:55 p.m.