README.md

CRAN DOI

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

Features

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:

```r 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:

```r

## 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:



Try the rBahadur package in your browser

Any scripts or data that you put into this service are public.

rBahadur documentation built on Aug. 26, 2023, 1:08 a.m.