Learn R Programming

bnpsd (version 1.1.1)

fst_admix: Calculate FST for the admixed individuals

Description

This function returns the \(F_{ST}\) of the admixed individuals given the admixture proportion matrix for \(n\) individuals and \(k\) intermediate subpopulations, the coancestry matrix of intermediate subpopulations (or its special cases, see coanc_subpops parameter below), and optional weights for individuals. This \(F_{ST}\) equals the weighted mean of the diagonal of the coancestry matrix (see coanc_admix).

Usage

fst_admix(admix_proportions, coanc_subpops, weights = NULL)

Arguments

admix_proportions

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

coanc_subpops

Either the \(k \times k\) intermediate subpopulation coancestry matrix (for the complete admixture model), or the length-\(k\) vector of intermediate subpopulation \(F_{ST}\) values (for the BN-PSD model), or a scalar \(F_{ST}\) value shared by all intermediate subpopulations.

weights

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
# number of individuals
n_ind <- 1000
# number of intermediate subpopulations
k_subpops <- 10

# differentiation of intermediate subpopulations
coanc_subpops <- ( 1 : k_subpops ) / k_subpops

# construct admixture proportions
admix_proportions <- admix_prop_1d_linear(n_ind, k_subpops, sigma = 1)

# lastly, calculate Fst!!! (uniform weights in this case)
fst_admix(admix_proportions, coanc_subpops)

# }

Run the code above in your browser using DataLab