R: Perform Chi-Square Test for Hardy-Weinberg Equilibrium
HWE.chisq
R Documentation
Perform Chi-Square Test for Hardy-Weinberg Equilibrium
Description
Test the null hypothesis that Hardy-Weinberg equilibrium holds using
the Chi-Square method.
Usage
HWE.chisq(x, ...)
## S3 method for class 'genotype'
HWE.chisq(x, simulate.p.value=TRUE, B=10000, ...)
Arguments
x
genotype or haplotype object.
simulate.p.value
a logical value indicating whether the p-value
should be computed using simulation instead of using the
Chi-Square approximation. Defaults to TRUE.
B
Number of simulation iterations to use when
simulate.p.value=TRUE. Defaults to 10000.
...
optional parameters passed to chisq.test
Details
This function generates a 2-way table of allele counts, then calls
chisq.test to compute a p-value for Hardy-Weinberg
Equilibrium. By default, it uses an unadjusted Chi-Square test
statistic and computes the p-value using a simulation/permutation
method. When simulate.p.value=FALSE, it computes the test
statistic using the Yates continuity correction and tests it against
the asymptotic Chi-Square distribution with the approproate degrees of
freedom.
Note: The Yates continuty correction is applied *only* when
simulate.p.value=FALSE, so that the reported test statistics
when simulate.p.value=FALSE and simulate.p.value=TRUE
will differ.