Learn R Programming

gap (version 1.1-1)

hwe: Hardy-Weinberg equlibrium test for a multiallelic marker

Description

Hardy-Weinberg equilibrium test

Usage

hwe(data, data.type="allele", yates.correct=FALSE, miss.val=0)

Arguments

data
A rectangular data containing the genotype, or an array of genotype counts
data.type
An option taking values "allele", "genotype", "count" if data is alleles, genotype or genotype count
yates.correct
A flag indicating if Yates' correction is used for Pearson $\chi^2$ statistic
miss.val
A list of missing values

Value

  • The returned value is a list containing:
  • allele.freqFrequencies of alleles
  • x2Pearson $\chi^2$
  • p.x2p value for $\chi^2$
  • lrtLog-likelihood ratio test statistic
  • p.lrtp value for lrt
  • dfDegree(s) of freedom
  • rho$\sqrt{\chi^2/N}$ the contingency table coefficient

Details

This function obtains Hardy-Weinberg equilibrium test statistics. It can handle data coded as allele numbers (default), genotype identifiers (by setting data.type="genotype") and counts corresponding to individual genotypes (by setting data.type="count") which requires that genotype counts for all n(n+1) possible genotypes, with n being the number of alleles.

For highly polymorphic markers when asymptotic results do not hold, please resort to hwe.hardy.

See Also

hwe.hardy

Examples

Run this code
data(hla)
hla.DQR <- hwe(hla[,3:4])
summary(hla.DQR)
a <- c(3,2,2)
a.out <- hwe(a,data.type="genotype")
a.out
a.out <- hwe(a,data.type="count")
a.out

Run the code above in your browser using DataLab