]> git.donarmstrong.com Git - ape.git/blob - man/heterozygosity.Rd
current 2.1 release
[ape.git] / man / heterozygosity.Rd
1 \name{heterozygosity}
2 \alias{heterozygosity}
3 \alias{H}
4 \title{Heterozygosity at a Locus Using Gene Frequencies}
5 \usage{
6 heterozygosity(x, variance = FALSE)
7 H(x, variance = FALSE)
8 }
9 \arguments{
10   \item{x}{a vector or a factor.}
11   \item{variance}{a logical indicating whether the variance of the 
12     estimated heterozygosity should be returned (\code{TRUE}), the
13     default being \code{FALSE}.}
14 }
15 \description{
16   This function computes the mean heterozygosity from gene frequencies,
17   and returns optionally the associated variance.
18 }
19 \value{
20   a numeric vector of length one with the estimated mean heterozygosity
21   (the default), or of length two if the variance is returned
22   \code{variance = TRUE}.
23 }
24 \details{
25   The argument \code{x} can be either a factor or a vector. If it is a
26   factor, then it is taken to give the individual alleles in the
27   population. If it is a numeric vector, then its values are taken to be
28   the numbers of each allele in the population. If it is a non-numeric
29   vector, it is a coerced as a factor.
30
31   The mean heterozygosity is estimated with:
32
33   \deqn{\hat{H} = \frac{n}{n-1} \left(1 - \sum_{i=1}^k p_i^2 \right)}{%
34     H = n(1 - SUM (FROM i=1 TO k) p_i^2)/(n - 1)}
35
36   where \eqn{n} is the number of genes in the sample, \eqn{k} is the
37   number of alleles, and \eqn{p_i} is the observed (relative) frequency
38   of the allele \eqn{i}.
39 }
40 \references{
41   Nei, M. (1987) \emph{Molecular evolutionary genetics}. New York:
42   Columbia University Press.
43 }
44 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
45 \seealso{
46   \code{\link{theta.s}}
47 }
48 \keyword{manip}
49 \keyword{univar}