genetics (version 1.3.8.1.3)

HWE.chisq: 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 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^2\) 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

Value

An object of class htest.

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.

See Also

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

Examples

Run this code
# NOT RUN {
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)


# }

Run the code above in your browser using DataLab