Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

HWE

Hardy-Weinberg Equilibrium test for multilocus data


Description

The function HWE.test is a generic function to perform Hardy-Weinberg Equilibrium tests defined by the genetics package. adegenet proposes a method for genind objects.

The output can be of two forms:
- a list of tests (class htest) for each locus-population combinaison
- a population x locus matrix containing p-values of the tests

Usage

## S3 method for class 'genind'
HWE.test(x,pop=NULL,permut=FALSE,nsim=1999,hide.NA=TRUE,res.type=c("full","matrix"))

Arguments

x

an object of class genind.

pop

a factor giving the population of each individual. If NULL, pop is seeked from x\$pop.

permut

a logical passed to HWE.test stating whether Monte Carlo version (TRUE) should be used or not (FALSE, default).

nsim

number of simulations if Monte Carlo is used (passed to HWE.test).

hide.NA

a logical stating whether non-tested loci (e.g., when an allele is fixed) should be hidden in the results (TRUE, default) or not (FALSE).

res.type

a character or a character vector whose only first argument is considered giving the type of result to display. If "full", then a list of complete tests is returned. If "matrix", then a matrix of p-values is returned.

Details

Monte Carlo procedure is quiet computer-intensive when large datasets are involved. For more precision on the performed test, read HWE.test documentation (genetics package).

Value

Returns either a list of tests or a matrix of p-values. In the first case, each test is designated by locus first and then by population. For instance if res is the "full" output of the function, then the test for population "PopA" at locus "Myloc" is given by res$Myloc$PopA. If res is a matrix of p-values, populations are in rows and loci in columns. P-values are given for the upper-tail: they correspond to the probability that an oberved chi-square statistic as high as or higher than the one observed occured under H0 (HWE).

In all cases, NA values are likely to appear in fixed loci, or entirely non-typed loci.

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk

See Also

HWE.test in the genetics package, chisq.test

Examples

## Not run: 
data(nancycats)
obj <- nancycats
if(require(genetics)){
obj.test <- HWE.test(obj)

# pvalues matrix to have a preview
HWE.test(obj,res.type="matrix")

#more precise view to...
obj.test$fca90$P10
}

## End(Not run)

adegenet

Exploratory Analysis of Genetic and Genomic Data

v2.1.3
GPL (>= 2)
Authors
Thibaut Jombart [aut] (<https://orcid.org/0000-0003-2226-8692>), Zhian N. Kamvar [aut, cre] (<https://orcid.org/0000-0003-1458-7108>), Caitlin Collins [ctb], Roman Lustrik [ctb], Marie-Pauline Beugin [ctb], Brian J. Knaus [ctb], Peter Solymos [ctb], Vladimir Mikryukov [ctb], Klaus Schliep [ctb], Tiago Maié [ctb], Libor Morkovsky [ctb], Ismail Ahmed [ctb], Anne Cori [ctb], Federico Calboli [ctb], RJ Ewing [ctb], Frédéric Michaud [ctb], Rebecca DeCamp [ctb], Alexandre Courtiol [ctb] (<https://orcid.org/0000-0003-0637-2959>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.