Learn R Programming

bnpsd (version 1.0.4)

fst: Calculate FST for the admixed individuals

Description

Given the admixture proportion matrix \(Q\) for \(n\) individuals and \(k\) intermediate subpopulations, the vector of intermediate inbreeding coefficients \(F\) (per-subpopulation \(F_{ST}\)'s), and weights for individuals, this function returns the \(F_{ST}\) of the admixed individuals. This \(F_{ST}\) equals the weighted mean of the diagonal of the coancestry matrix (see coanc).

Usage

fst(Q, F, w)

Arguments

Q

The \(n \times k\) admixture proportion matrix

F

The length-\(k\) vector of subpopulation inbreeding coefficients

w

The length-\(n\) vector of weights for individuals that define \(F_{ST}\) (default uniform weights)

Value

The \(F_{ST}\) of the admixed individuals

Examples

Run this code
# NOT RUN {
# set desired parameters
n <- 1000 # number of individuals
k <- 10 # number of intermediate subpopulations
s <- 0.5 # desired bias coefficient
sigma <- 1 # for 1D admixture model
# differentiation of intermediate subpopulations
F <- (1:k)/k
# construct final admixture proportions
Q <- q1d(n=n, k=k, sigma=sigma)
# lastly, calculate Fst!!! (uniform weights in this case)
F <- fst(Q, F)

# }

Run the code above in your browser using DataLab