hw.test: Test of Hardy-Weinberg Equilibrium

Description Usage Arguments Details Value Author(s) References Examples

Description

This function tests, for a series of loci, the hypothesis that genotype frequencies follow the Hardy–Weinberg equilibrium. hw.test is a generic with methods for the classes "loci" and genind. Note that the latter replaces HWE.test.genind in the adegenet package.

Usage

1
2
3
4
5
hw.test(x, B = 1000, ...)
## S3 method for class 'loci'
hw.test(x, B = 1000, ...)
## S3 method for class 'genind'
hw.test(x, B = 1000, ...)

Arguments

x

an object of class "loci" or genind.

B

the number of replicates for the Monte Carlo procedure; for the regular HW test, set B = 0 (see details).

...

further arguments to be passed.

Details

This test can be performed with any level of ploidy. Two versions of the test are available: the classical chi^2-test based on the expected genotype frequencies calculated from the allelic frequencies, and an exact test based on Monte Carlo permutations of alleles (Guo and Thompson 1992). For the moment, the latter version is available only for diploids. Set B = 0 if you want to skip the second test.

Value

A matrix with three or four columns with the chi^2-value, the number of degrees of freedom, the associated P-value, and possibly the P-value from the Monte Carlo test. The rows of this matrix are the different loci in x.

Author(s)

Main code by Emmanuel Paradis; wrapper for genind objects by Thibaut Jombart.

References

Guo, S. W. and Thompson, E. A. (1992) Performing the exact test of Hardy–Weinberg proportion for multiple alleles. Biometrics, 48, 361–372.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
require(adegenet)

## load data
data(nancycats)

## test on genind object, no permutation
hw.test(nancycats, B=0)

## test on loci object
x <- as.loci(nancycats)
hw.test(x)

## End(Not run)
data(jaguar)
hw.test(jaguar)

Example output

Loading required package: ape
Loading required package: adegenet
Loading required package: ade4

   /// adegenet 2.0.1 is loaded ////////////

   > overview: '?adegenet'
   > tutorials/doc/questions: 'adegenetWeb()' 
   > bug reports/feature requests: adegenetIssues()



Attaching package: 'pegas'

The following object is masked from 'package:ade4':

    amova

The following object is masked from 'package:ape':

    mst

          chi^2  df  Pr(chi^2 >)
fca8  395.80006 120 0.000000e+00
fca23 239.34221  55 0.000000e+00
fca43 434.33397  45 0.000000e+00
fca45  66.11849  36 1.622163e-03
fca77 270.52066  66 0.000000e+00
fca78 402.80002  28 0.000000e+00
fca90 217.19836  66 0.000000e+00
fca96 193.36764  66 1.965095e-14
fca37 291.00731 153 1.209777e-10
          chi^2  df  Pr(chi^2 >) Pr.exact
fca8  395.80006 120 0.000000e+00        0
fca23 239.34221  55 0.000000e+00        0
fca43 434.33397  45 0.000000e+00        0
fca45  66.11849  36 1.622163e-03        0
fca77 270.52066  66 0.000000e+00        0
fca78 402.80002  28 0.000000e+00        0
fca90 217.19836  66 0.000000e+00        0
fca96 193.36764  66 1.965095e-14        0
fca37 291.00731 153 1.209777e-10        0
           chi^2  df  Pr(chi^2 >) Pr.exact
FCA742 183.86464 120 1.594495e-04    0.007
FCA723 103.12121  21 8.062440e-13    0.001
FCA740  74.20811  15 7.868073e-10    0.000
FCA441  41.33714  10 9.834077e-06    0.004
FCA391  76.09323  36 1.080868e-04    0.409
F98    120.42555  10 0.000000e+00    0.003
F53    119.13991  55 1.242116e-06    0.002
F124    90.44434  36 1.401578e-06    0.071
F146    12.45142  10 2.559795e-01    0.315
F85    122.68186  91 1.505069e-02    0.004
F42    134.42730  45 7.690482e-11    0.000
FCA453  21.65249  15 1.172451e-01    0.131
FCA741  11.60034   6 7.150214e-02    0.046

pegas documentation built on May 17, 2021, 9:08 a.m.