HWE.chisq: Perform Chi-Square Test for Hardy-Weinberg Equilibrium

Description Usage Arguments Details Value See Also Examples

Description

Test the null hypothesis that Hardy-Weinberg equilibrium holds using the Chi-Square method.

Usage

1
2
3
4
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.

Value

An object of class htest.

See Also

HWE.exact, HWE.test, diseq, diseq.ci, allele, chisq.test, boot, boot.ci

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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.chisq(g1)
# compare with
HWE.exact(g1)
# and 
HWE.test(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.chisq(g3, B=10000)

kindlychung/genetics documentation built on May 20, 2019, 9:58 a.m.