MyNixOS website logo
Description

Assortative Mating Simulation and Multivariate Bernoulli Variates.

Simulation of phenotype / genotype data under assortative mating. Includes functions for generating Bahadur order-2 multivariate Bernoulli variables with general and diagonal-plus-low-rank correlation structures. Further details are provided in: Border and Malik (2022) <doi:10.1101/2022.10.13.512132>.

CRAN DOI

Efficient simulation of genotype / phenotype data under assortative mating by generating Bahadur order-2 multivariate Bernoulli distributed random variates.

Features

  • Multivariate Bernoulli (MVB) distribution samplers
    • rb_dplr: generate Bahadur order-2 MVB variates with diagonal-plus-low-rank (DPLR) correlation structures
    • rb_unstr: generate Bahadur order-2 MVB variates with arbitrary correlation structures
  • Assortative mating modeling tools
    • Compute equilibrium parameters under univariate AM
      • h2_eq: compute equilibrium heritability
      • rg_eq: compute equilibrium cross-mate genetic correlation
      • vg_eq: compute equilibrium genetic variance
    • Generate genotype / phenotype data given initial conditions
      • am_simulate: complete univariate genotype / phenotype simulation
      • am_covariance_structure: compute outer-product covariance component for AM-induced DPLR covariance structure

Installation

rBahadur is now on CRAN:

install.packages("rBahadur")

Alternatively, you can install directly from github using the install_github function provided by the remotes library:

remotes::install_github("rborder/rBahadur")

Usage

Here we demonstrate using rBahadur to simulate genotype / phenotype at equilibrium under AM: given the following parameters:

  • h2_0: panmictic heritability
  • r: cross-mate phenotypic correlation
  • m: number of diploid, biallelic causal variants
  • n: number of individuals to simulate
  • min_MAF: minimum minor allele frequency
set.seed(2022)
h2_0 = .5; m = 2000; n = 5000; r =.5; min_MAF=.05

## simulate genotype/phenotype data
sim_dat <- am_simulate(h2_0, r, m, n)

We compare the target and realized allele frequencies:


## plot empirical first moments of genotypes versus expectations
afs_emp <- colMeans(sim_dat$X)/2
plot(sim_dat$AF, afs_emp)

We compare the expected equilibrium heritability to that realized in simulation:


## empirical h2 vs expected equilibrium h2
(emp_h2 <- var(sim_dat$g)/var(sim_dat$y))
h2_eq(r, .5)

Citation

Developed by Richard Border and Osman Malik. For further details, or if you find this software useful, please cite:

  • Border, R. and Malik, O.A., 2022. rBahadur: efficient simulation of structured high-dimensional genotype data with applications to assortative mating. BMC Bioinformatics. https://doi.org/10.1186/s12859-023-05442-6

Background reading:

  • The Multivariate Bernoulli distribution and the Bahadur representation:
    • Teugels, J.L., 1990. Some representations of the multivariate Bernoulli and binomial distributions. Journal of Multivariate Analysis, 32(2), pp.256-268. https://doi.org/10.1016/0047-259X(90)90084-U
    • Bahadur, R.R., 1959. A representation of the joint distribution of responses to n dichotomous items. School of Aviation Medicine, Randolph AFB, Texas. https://apps.dtic.mil/sti/citations/AD0706093
  • Cross-generational dynamics of genetic variants under univariate assortative mating:
    • Nagylaki, T., 1982. Assortative mating for a quantitative character. Journal of Mathematical Biology, 16, pp.57–74. https://doi.org/10.1007/BF00275161
Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows