1 ## heterozygosity.R (2002-08-28)
3 ## Heterozygosity at a Locus Using Gene Frequencies
5 ## Copyright 2002 Emmanuel Paradis
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 heterozygosity <- function(x, variance = FALSE)
20 if (is.factor(x)) { # ne pas remplacer par `else'...
26 H <- n * (1 - sp2) / (n - 1)
29 var.H <- 2 * (2 * (n - 2) * (sp3 - sp2^2) + sp2 - sp2^2) / (n * (n - 1))
35 H <- function(x, variance = FALSE) heterozygosity(x, variance)