| HWE.test {genetics} | R Documentation |
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"), ...)
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 TRUE. |
B |
Number of simulation iterations to use when
simulate.p.value=TRUE. Defaults to 10000. |
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'", and "r". |
... |
optional parameters passed to HWE.test (data.frame
method) or chisq.test (base method). |
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 diseq object providing details on the
disequilibrium estimates. |
ci |
A diseq.ci object providing details on the
bootstrap confidence intervals for the disequilibrium estimates. |
test |
A htest object providing details on the
permutation based Chi-square test. |
call |
function call used to creat this object. |
conf, B, ci.B, simulate.p.value |
values used for these arguments. |
Gregory R. Warnes warnes@bst.rochester.edu
genotype,
diseq,
diseq.ci,
HWE.chisq,
HWE.exact,
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
diseq(g1)
diseq.ci(g1)
HWE.chisq(g1)
HWE.exact(g1)
three.data <- c(rep("A/A",8),
rep("C/A",20),
rep("C/T",20),
rep("C/C",10),
rep("T/T",3))
g3 <- genotype(three.data)
g3
HWE.test(g3, ci.B=10000)