generate_QT_assortative_mating: Generate father mother pairs

Description Usage Arguments Examples

View source: R/am_sims.R

Description

This is really just a test that the simulations and the correlation coefficients work.

Usage

1
2
3
4
5
6
7
8
9
generate_QT_assortative_mating(
  population_size,
  loci_A,
  loci_B,
  environ_var,
  corr_coeff = 0,
  n_loci,
  allele_freq = 0.5
)

Arguments

population_size

The Size of the populations to simulate. Equal numbers of males and females of this size.

loci_A

loci affecting trait A

loci_B

loci affecting trait B

environ_var

environmental variance

corr_coeff

Correlation coefficient between phenotype in males and females

n_loci

The number of loci to simulate. Not always needed.

allele_freq

The allele frequency of sampled loci. Either a single value or a vector at least as long as max loci specified.

Examples

1
2
3
4
5
6
7
8
9
g1 <- generate_QT_assortative_mating(population_size = 100000, loci_A = 1:100, loci_B = 101:200,
                                     environ_var = 0.3, corr_coeff = 0.3)
cor(g1$mother_phenotype$pheno, g1$father_phenotype$pheno)#
plot(g1$mother_phenotype$pheno, g1$father_phenotype$pheno)
# Simulate for loci with rarer variants
g2 <- generate_QT_assortative_mating(population_size = 100000, loci_A = 1:100, loci_B = 101:200,
                         environ_var = 0.3, corr_coeff = 0.3, allele_freq = runif(200, 0.01, 0.05))
cor(g2$mother_phenotype$pheno, g2$father_phenotype$pheno)
plot(g2$mother_phenotype$pheno, g2$father_phenotype$pheno)

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