HWE.test: Estimate Disequilibrium and Test for Hardy-Weinberg...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/HWE.test.R

Description

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

Usage

1
2
3
4
5
6
7
8
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-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'", "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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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)

genetics documentation built on March 1, 2021, 9:06 a.m.

Related to HWE.test in genetics...