Estimate Disequilibrium and Test for Hardy-Weinberg Equilibrium
Estimate disequilibrium parameter and test the null hypothesis that Hardy-Weinberg equilibrium holds.
HWE.test(x, ...) ## S3 method for class 'genotype' HWE.test(x, exact = nallele(x)==2, simulate.p.value=!exact, B=10000, conf=0.95, ci.B=1000, ... ) ## S3 method for class 'data.frame' HWE.test(x, ..., do.Allele.Freq=TRUE, do.HWE.test=TRUE) ## S3 method for class 'HWE.test' print(x, show=c("D","D'","r","table"), ...)
x |
genotype or haplotype object. |
exact |
a logical value indicated whether the p-value should be computed using the exact method, which is only available for 2 allele genotypes. |
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 |
B |
Number of simulation iterations to use when
|
conf |
Confidence level to use when computing the confidence level for D-hat. Defaults to 0.95, should be in (0,1). |
ci.B |
Number of bootstrap iterations to use when computing the confidence interval. Defaults to 1000. |
show |
a character vector containing the names of HWE test statistics to display from the set of "D", "D'", "r", and "table". |
... |
optional parameters passed to |
do.Allele.Freq |
logicial indication whether to summarize allele frequencies. |
do.HWE.test |
logicial indication whether to perform HWE tests |
HWE.test calls diseq
to computes the Hardy-Weinberg
(dis)equilibrium statistics D, D', and r (correlation coefficient).
Next it calls diseq.ci
to compute a bootstrap confidence
interval for these estimates. Finally, it calls
chisq.test
to compute a p-value for Hardy-Weinberg
Equilibrium using a simulation/permutation method.
Using bootstrapping for the confidence interval and simulation for the p-value avoids reliance on the assumptions the underlying Chi-square approximation. This is particularly important when some allele pairs have small counts.
For details on the definition of D, D', and r, see the help page for
diseq
.
An object of class HWE.test
with components
diseq |
A |
ci |
A |
test |
A |
call |
function call used to creat this object. |
conf, B, ci.B, simulate.p.value |
values used for these arguments. |
Gregory R. Warnes greg@warnes.net
## Marker with two alleles: example.data <- c("D/D","D/I","D/D","I/I","D/D", "D/D","D/D","D/D","I/I","") g1 <- genotype(example.data) g1 HWE.test(g1) ## Compare with individual calculations: diseq(g1) diseq.ci(g1) HWE.chisq(g1) HWE.exact(g1) ## Marker with three alleles: A, C, and T three.data <- c(rep("A/A",16), rep("C/A",40), rep("C/T",40), rep("C/C",20), rep("T/T",6)) g3 <- genotype(three.data) g3 HWE.test(g3, ci.B=10000)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.