fst_admix: Calculate FST for the admixed individuals

Description Usage Arguments Details Value Examples

View source: R/fst_admix.R

Description

This function returns the generalized FST of the admixed individuals given their admixture proportion matrix, the coancestry matrix of intermediate subpopulations (or its special cases, see coanc_subpops parameter below), and optional weights for individuals. This FST equals the weighted mean of the diagonal of the coancestry matrix (see coanc_admix()). Below there are n individuals and k intermediate subpopulations.

Usage

1
fst_admix(admix_proportions, coanc_subpops, weights = NULL)

Arguments

admix_proportions

The n-by-k admixture proportion matrix

coanc_subpops

Either the k-by-k intermediate subpopulation coancestry matrix (for the complete admixture model), or the length-k vector of intermediate subpopulation FST values (for the BN-PSD model; assumes zero coancestries between subpopulations), or a scalar FST value shared by all intermediate subpopulations (also assumes zero coancestry between subpopulations).

weights

Optional length-n vector of weights for individuals that define their generalized FST (default uniform weights)

Details

As a precaution, function stops if both inputs have names and the column names of admix_proportions and the names in coanc_subpops disagree, which might be because these two matrices are not aligned or there is some other inconsistency.

Value

The generalized FST of the admixed individuals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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)

bnpsd documentation built on Aug. 25, 2021, 5:07 p.m.