Efficient simulation of genotype / phenotype data under assortative mating by generating Bahadur order-2 multivariate Bernoulli distributed random variates.
rb_dplr
: generate Bahadur order-2 MVB variates with
diagonal-plus-low-rank (DPLR) correlation structuresrb_unstr
: generate Bahadur order-2 MVB variates with
arbitrary correlation structuresh2_eq
: compute equilibrium heritabilityrg_eq
: compute equilibrium cross-mate genetic
correlationvg_eq
: compute equilibrium genetic varianceam_simulate
: complete univariate genotype / phenotype
simulationam_covariance_structure
: compute outer-product
covariance component for AM-induced DPLR covariance structurerBahadur
is now on CRAN:
install.packages("rBahadur")
Alternatively, you can install directly from github using the
install_github
function provided by the remotes
library:
::install_github("rborder/rBahadur") remotes
Here we demonstrate using rBahadur
to simulate genotype
/ phenotype at equilibrium under AM: given the following parameters:
h2_0
: panmictic heritabilityr
: cross-mate phenotypic correlationm
: number of diploid, biallelic causal variantsn
: number of individuals to simulatemin_MAF
: minimum minor allele frequencyset.seed(2022)
= .5; m = 2000; n = 5000; r =.5; min_MAF=.05
h2_0
## simulate genotype/phenotype data
<- am_simulate(h2_0, r, m, n) sim_dat
We compare the target and realized allele frequencies:
## plot empirical first moments of genotypes versus expectations
<- colMeans(sim_dat$X)/2
afs_emp plot(sim_dat$AF, afs_emp)
We compare the expected equilibrium heritability to that realized in simulation:
## empirical h2 vs expected equilibrium h2
<- var(sim_dat$g)/var(sim_dat$y))
(emp_h2 h2_eq(r, .5)
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