Learn R Programming

adegenet (version 1.4-2)

Hs: Expected heterozygosity

Description

This function computes the expected heterozygosity (Hs) within populations of a genpop object. This function is available for codominant markers (@type="codom") only. Hs is commonly used for measuring within population genetic diversity (and as such, it still has sense when computed from haploid data).

Usage

Hs(x, truenames=TRUE)

Arguments

x
an object of class genpop.
truenames
a logical indicating whether true labels (as opposed to generic labels) should be used to name the output.

Value

  • A vector of Hs values (one value per population).

encoding

UTF-8

Details

Let m(k) be the number of alleles of locus k, with a total of K loci. We note $f_i$ the allele frequency of allele i in a given population. Then, $Hs$ is given for a given population by: $\frac{1}{K} \sum_{k=1}^K (1 - \sum_{i=1}^{m(k)} f_i^2)$

Examples

Run this code
data(nancycats)
Hs(genind2genpop(nancycats))

Run the code above in your browser using DataLab