HWE.test {genetics}R Documentation

Estimate Disequilibrium and Test for Hardy-Weinberg Equilibrium

Description

Estimate disequilibrium parameter and test the null hypothesis that Hardy-Weinberg equilibrium holds.

Usage

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"), ...)

Arguments

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^2 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'", "r", and "table".

...

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

Details

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.

Value

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.

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

genotype, diseq, diseq.ci, HWE.chisq, HWE.exact, chisq.test

Examples


## 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)

[Package genetics version 1.3.8.1.3 Index]