draw_p_anc {bnpsd}R Documentation

Draw random Uniform or Beta ancestral allele frequencies

Description

This is simply a wrapper around stats::runif() or stats::rbeta() (depending on parameters) with different defaults and additional validations.

Usage

draw_p_anc(m_loci, p_min = 0.01, p_max = 0.5, beta = NA)

Arguments

m_loci

Number of loci to draw.

p_min

Minimum allele frequency to draw (Uniform case only).

p_max

Maximum allele frequency to draw (Uniform case only).

beta

Shape parameter for a symmetric Beta. If NA (default), Uniform(p_min, p_max) is used. Otherwise, a Symmetric Beta is used and the user-specified range is ignored (values in [0, 1] will be returned).

Value

A length-m vector of random ancestral allele frequencies

Examples

# Default is uniform with range between 0.01 and 0.5
p_anc <- draw_p_anc(m_loci = 10)

# Use of `beta` triggers a symmetric Beta distribution.
# This parameter has increased density for rare minor allele frequencies,
# resembling the 1000 Genomes allele frequency distribution
p_anc <- draw_p_anc(m_loci = 10, beta = 0.03)


[Package bnpsd version 1.3.13 Index]