Learn R Programming

bnpsd (version 1.0.4)

coanc: 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(Q, F)

Arguments

Q

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

F

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 \(\Theta\)

Examples

Run this code
# NOT RUN {
# a trivial case: unadmixed individuals from independent subpopulations
n <- 5 # number of individuals/subpops
Q <- diag(rep.int(1, n)) # unadmixed individuals
F <- 0.2 # equal Fst for all subpops
Theta <- coanc(Q, F) # diagonal coancestry matryx

# a more complicated admixture model
n <- 5 # number of individuals
k <- 2 # number of intermediate subpops
sigma <- 1 # dispersion parameter of intermediate subpops
Q <- q1d(n, k, sigma) # non-trivial admixture proportions
F <- c(0.1, 0.3) # different Fst for each of the k subpops
Theta <- coanc(Q, F) # non-trivial coancestry matrix

# }

Run the code above in your browser using DataLab