fst_admix | R Documentation |
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.
fst_admix(admix_proportions, coanc_subpops, weights = NULL)
admix_proportions |
The |
coanc_subpops |
Either the |
weights |
Optional length- |
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.
The generalized FST of the admixed individuals
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.