Exact test for Hardy-Weinberg equilibrium
HWExact
performs an exact test for Hardy-Weinberg equilibrium
HWExact(X, alternative = "two.sided", pvaluetype = "selome", eps=1e-10, x.linked = FALSE, verbose = TRUE)
X |
vector with the genotype counts AA, AB, BB |
alternative |
|
pvaluetype |
if |
x.linked |
|
eps |
a tolerance that can be set for comparing probabilities in order to include tied outcomes |
verbose |
print results or not. |
HWExact
uses the recursion equations described by Wigginton
et. al.
For testing large sets of bi-allelic variants, use the faster code in HWExactStats
.
For large samples, HWExact
may give the error message:
"evaluation nested too deeply: infinite recursion". This can usually
be resolved by increasing R's limit on nested expressions with
options(expressions=10000)
or a higher limit. With higher
limits, the error message "protect(): protection stack overflow" can
occur. This error can usually be resolved by increasing R's
protection stack with the command line option
--max-ppsize 100000
or higer values. However, with such large
samples the exact test will give virtually the same result as a
chi-square test, and it may be easier to use HWChisq
in these
circumstances.
pval |
p-value of the exact test |
prob |
probabilities of all possible samples with the same sample size and minor allele count |
pofthesample |
probability of the observed sample |
Jan Graffelman (jan.graffelman@upc.edu)
Weir, B.S. (1996) Genetic data analysis II. Sinauer Associates, Massachusetts. See Chapter3.
Wigginton, J.E., Cutler, D.J. and Abecasis, G.R. (2005) A note on exact tests of Hardy-Weinberg equilibrium, American Journal of Human Genetics (76) pp. 887-893.
Graffelman, J. and Moreno, V. (2013) The mid p-value in exact tests for Hardy-Weinberg equilibrium, Statistical Applications in Genetics and Molecular Biology 12(4) pp. 433-448.
# # Example for an autosomal marker using the standard exact p-value # x <- c(298,489,213) names(x) <- c("MM","MN","NN") HW.test <- HWExact(x,verbose=TRUE) # # Example for an autosomal marker using the mid p-value # HW.test <- HWExact(x,verbose=TRUE,pvaluetype="midp") # # Example x-linked marker # rs5968922 <- c(A=392, B=212, AA=275, AB=296, BB=80 ) HWExact(rs5968922,x.linked=TRUE,verbose=TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.