Learn R Programming

bnpsd (version 1.1.1)

coanc_admix: Construct the coancestry matrix of an admixture model

Description

In the most general case, the \(n \times n\) coancestry matrix \(\Theta\) of admixed individuals is determined by the \(n \times k\) admixture proportion matrix \(Q\) and the \(k \times k\) intermediate subpopulation coancestry matrix \(\Psi\), given by $$\Theta = Q \Psi Q^T$$ In the BN-PSD model \(\Psi\) is a diagonal matrix (with \(F_{ST}\) values for the intermediate subpopulations along the diagonal, zero values off-diagonal).

Usage

coanc_admix(admix_proportions, coanc_subpops)

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.

Value

The \(n \times n\) coancestry matrix.

Examples

Run this code
# NOT RUN {
# a trivial case: unadmixed individuals from independent subpopulations
# number of individuals and subpops
n_ind <- 5
# unadmixed individuals
admix_proportions <- diag(rep.int(1, n_ind))
# equal Fst for all subpops
coanc_subpops <- 0.2
# diagonal coancestry matryx
coancestry <- coanc_admix(admix_proportions, coanc_subpops)

# a more complicated admixture model
# number of individuals
n_ind <- 5
# number of intermediate subpops
k_subpops <- 2
# non-trivial admixture proportions
admix_proportions <- admix_prop_1d_linear(n_ind, k_subpops, sigma = 1)
# different Fst for each of the k_subpops
coanc_subpops <- c(0.1, 0.3)
# non-trivial coancestry matrix
coancestry <- coanc_admix(admix_proportions, coanc_subpops)

# }

Run the code above in your browser using DataLab