hwe: Hardy-Weinberg equlibrium test
Description
Hardy-Weinberg equilibrium testUsage
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^2$ statistic
miss.val
A list of missing values
Value
- The returned value is a list containing:
- x2Pearson $\chi^2$
- p.x2p value for $\chi^2$
- lrtLog-likelihood ratio test statistic
- p.lrtp value for lrt
- dfDegree(s) of freedom
- rho$\chi^2/N$ the effect size
synopsis
hwe(data, is.count=FALSE, is.genotype=FALSE, yates.correct=FALSE, miss.val=0)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.Examples
Run this codea <- c(3,2,2)
a.out <- hwe(a,is.genotype=TRUE)
a.out
a.out <- hwe(a,is.count=TRUE)
a.out
Run the code above in your browser using DataLab