heterozygosity(x, variance = FALSE)
H(x, variance = FALSE)
TRUE
), the
default being FALSE
.variance = TRUE
.x
can be either a factor or a vector. If it is a
factor, then it is taken to give the individual alleles in the
population. If it is a numeric vector, then its values are taken to be
the numbers of each allele in the population. If it is a non-numeric
vector, it is a coerced as a factor.
The mean heterozygosity is estimated with:
$$\hat{H} = \frac{n}{n-1} \left(1 - \sum_{i=1}^k p_i^2 \right)$$
where $n$ is the number of genes in the sample, $k$ is the
number of alleles, and $p_i$ is the observed (relative) frequency
of the allele $i$.theta.s