hwe {gap}R Documentation

Hardy-Weinberg equlibrium test

Description

Hardy-Weinberg equilibrium test

Usage

hwe(data,yates.correct=FALSE, miss.val=0)
hwe(data,is.genotype=FALSE, yates.correct=FALSE, miss.val=0)
hwe(data,is.count=FALSE, yates.correct=FALSE, miss.val=0)

Arguments

data a rectangular data containing the genotype, or an array of genotype counts
is.genotype A flag indicating if the data is an array of genotypes
is.count A flag indicating if the data is an array of genotypes count
yates.correct A flag indicating if Yates' correction is used for Pearson chi-squared statistic
miss.val A list of missing values

Details

This function obtains Hardy-Weinberg equilibrium test statistics. It can handle data coded as allele numbers (default), genotype identifiers (by setting is.genotype=TRUE) and counts corresponding to individual genotypes (by setting is.count=TRUE) ; the latter does not need is.genotype to be specified but requires that genotype counts for all possible genotypes, i.e. n(n+1)/2, where n is the number of alleles.

Value

The returned value is a list containing:

x2 Pearson chi-square
p.x2 p value for chi-square
lrt Log-likelihood ratio test statistic
p.lrt p value for lrt
df Degree(s) of freedom
rho chi-square/N the effect size

Author(s)

Jing hua Zhao

See Also

hwe.hardy

Examples

## Not run: 
a <- c(3,2,2)
a.out <- hwe(a,is.genotype=TRUE)
a.out
a.out <- hwe(a,is.count=TRUE)
a.out
## End(Not run)

[Package Contents]