Q_stat: Compute Fst, FstMax, and the ratio Fst/FstMax for a Q matrix

View source: R/fstruct_functions.R

Q_statR Documentation

Compute Fst, FstMax, and the ratio Fst/FstMax for a Q matrix

Description

This function computes a statistical measure of ancestry variability, Fst/FstMax, for a Q matrix, the default output of population structure inference software programs such as STRUCTURE and ADMIXTURE. The function returns a named list containing the ratio Fst/FstMax as well as the values of Fst and FstMax.

Usage

Q_stat(Q, K = ncol(Q))

Arguments

Q

A dataframe, matrix, or array representing a Q matrix. Each row represents an individual and the last K columns contain individual membership coefficients. The first few columns may contain information not relevant to this plot; their inclusion is optional. When restricted to the last K columns, the rows of this matrix must sum to approximately 1.

K

The number of ancestral clusters in the Q matrix. Each individual must have K membership coefficients.

Details

Fst/FstMax is a statistic that takes a value of 0 when every individual in a population has identical ancestry, and a value of 1 when the ancestry is maximally variable (see *our paper* for more details). It is based on the population differentiation statistic Fst which, in its traditional application, is used to measure variability in allele frequencies

Value

A named list of containing the following entries:

  • Fst: Fst computed as if each individual is a population, and each ancestral cluster is an allele.

  • FstMax: The maximum value of Fst (for fixed frequency of the most frequent allele, or, in the analogy, the membership of the most prevalent ancestral cluster).

  • ratio: The ratio Fst/FstMax. We recommend that this statistic be used to quantify ancestry variability and to compare the variability of two or more Q matrices.

Examples

Q_stat(
  # Make an example matrix of membership coefficients.
  # Each row is an individual. Rows sum to 1.
  Q = matrix(c(
    .4, .2, .4,
    .5, .3, .2,
    .5, .4, .1,
    .6, .1, .3,
    .6, .3, .1
  ),
  nrow = 5,
  byrow = TRUE
  ),
  K = 3
) # How many ancestry coefficients per individual?

MaikeMorrison/FSTruct documentation built on Aug. 26, 2023, 7:01 a.m.