Learn R Programming

bnpsd (version 1.0.4)

rpint: Draw intermediate subpopulation allele frequencies

Description

Intermediate subpopulation allele frequencies \(p_i^{S_u}\) for subpopulation \(S_u\) at locus \(i\) are drawn from the Balding-Nichols distribution with ancestral allele frequency \(p_i^T\) and \(F_{ST}\) parameter \(f^T_{S_u}\) as $$p_i^{S_u} \sim \mbox{Beta}(\nu_u p_i^T, \nu_u (1-p_i^T)),$$ where \(\nu_u = 1/f^T_{S_u} - 1\). Below \(m\) is the number of loci and \(k\) is the number of subpopulations.

Usage

rpint(pAnc, F)

Arguments

pAnc

The length-\(m\) vector of ancestral allele frequencies per locus

F

The length-\(k\) vector of subpopulation \(F_{ST}\) values

Value

The \(m \times k\) matrix of intermediate subpopulation allele frequencies

Examples

Run this code
# NOT RUN {
m <- 10 # number of loci
pAnc <- rpanc(m) # random vector of ancestral allele frequencies
F <- c(0.1, 0.3) # FST values for two subpops
B <- rpint(pAnc, F) # matrix of intermediate subpop allele freqs

# }

Run the code above in your browser using DataLab