he {HardyWeinberg}R Documentation

Calculate expected heterozygosity (He)

Description

Function he calculates the expected heterozygosity for a biallelic genetic variant.

Usage

he(x, bias.correct = TRUE)

Arguments

x

a vector or matrix with genotype counts.

bias.correct

if bias.correct = TRUE a correction for bias will be applied.

Details

x can be a vector of genotype counts for a single marker (AA,AB,BB) or a three-column matrix of genotype counts for multiple markers.

Value

a vector of expected heterozygosities.

Author(s)

Jan Graffelman (jan.graffelman@upc.edu)

See Also

af, maf.

Examples

#
# He for a single marker
#
x <- c(MM=298,MN=489,NN=213)
he(x)
#
# He for a matrix of rmarkers
#
set.seed(123)
X <- HWData(10,100)
he(X)
he(X,bias.correct = FALSE)

[Package HardyWeinberg version 1.7.8 Index]