# fst: Extract FST from a population-level kinship matrix or vector... In popkin: Estimate Kinship and FST under Arbitrary Population Structure

## Description

This function simply returns the weighted mean inbreeding coefficient f_j^T. If no weights are provided, the regular mean f_j^T is returned. If a kinship matrix Φ^T is provided, then f_j^T are extracted from its diagonal using inbr (assumes the diagonal of Φ^T is φ_jj^T = (1+f_j^T)/2 as popkin returns, and not f_j^T as inbrDiag returns).

## Usage

 1 fst(x, w) 

## Arguments

 x The vector of inbreeding coefficients (f_j^T), or the kinship matrix Φ^T if x is a matrix. w Weights for individuals (optional, defaults to uniform weights)

## Details

The returned weighted mean inbreeding coefficient equals the generalized FST if all individuals are "locally outbred" (i.e. if the self relatedness of every individual stems entirely from the population structure rather than due partly to having unusually closely related parents, such as first or second cousins). Note most individuals in population-scale human data are locally outbred. If there are locally inbred individuals, the returned value will overestimate FST.

FST

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ## Get FST from a genotype matrix ## Construct toy data X <- matrix(c(0,1,2,1,0,1,1,0,2), nrow=3, byrow=TRUE) # genotype matrix subpops <- c(1,1,2) # subpopulation assignments for individuals ## NOTE: for BED-formatted input, use BEDMatrix! ## "file" is path to BED file (excluding .bed extension) # library(BEDMatrix) # X <- BEDMatrix(file) # load genotype matrix object ## estimate the kinship matrix "Phi" from the genotypes "X"! Phi <- popkin(X, subpops) # calculate kinship from X and optional subpop labels w <- weightsSubpops(subpops) # can weigh individuals so subpopulations are balanced Fst <- fst(Phi, w) # use kinship matrix and weights to calculate fst Fst <- fst(Phi) # no weights implies uniform weights inbr <- inbr(Phi) # if you extracted inbr for some other analysis... Fst <- fst(inbr, w) # ...use this inbreeding vector as input too! 

popkin documentation built on Jan. 27, 2018, 1:03 a.m.