am_simulate {rBahadur} | R Documentation |
Simulate genotype/phenotype data under equilibrium univariate AM.
Description
Simulate genotype/phenotype data under equilibrium univariate AM.
Usage
am_simulate(h2_0, r, m, n, afs = NULL, min_MAF = 0.1, haplotypes = FALSE)
Arguments
h2_0 |
generation zero (panmictic) heritability |
r |
cross-mate phenotypic correlation |
m |
number of biallelic causal variants |
n |
sample size |
afs |
(optional). Allele frequencies to use. If not provided, |
min_MAF |
(optional) minimum minor allele frequency for causal variants.
Ignored if if |
haplotypes |
logical. If TRUE, includes (phased) haploid genotypes in output. Defaults to FALSE |
Value
A list including the following objects:
-
y
: phenotype vector -
g
: heritable component of the phenotype vector -
X
: matrix of diploid genotypes -
AF
: vector of allele frequencies -
beta_std
: standardized genetic effects -
beta_raw
: unstandardized genetic effects -
H
: matrix of haploid genotypes (returned only ifhaplotypes
=TRUE)
Examples
set.seed(1)
h2_0 = .5; m = 200; n = 1000; r =.5
## simulate genotype/phenotype data
sim_dat <- am_simulate(h2_0, r, m, n)
str(sim_dat)
## empirical h2 vs expected equilibrium h2
(emp_h2 <- var(sim_dat$g)/var(sim_dat$y))
h2_eq(r, h2_0)