\name{HWE}
\alias{HWE}
\title{Test the significances of Hardy-Weinberg Equilibrium (dis)equilibrium statistics}
\description{
Test the significances of Hardy-Weinberg Equilibrium (dis)equilibrium statistics for each marker in a data set.
}
\usage{
HWE(object, 
    test = c("exact", "permutation", "chisq"), 
    B = 10000, 
    R = 1000, 
    correct = TRUE, 
    conf = c(0.95), 
    na.rm = TRUE, 
    founderOnly = TRUE, 
    ...) 
}
\arguments{
  \item{object}{a geneSet object.}
  \item{test}{specifys the test method. Available methods are \dQuote{exact},
\dQuote{permutation}, \dQuote{chisq}.}
  \item{B}{an integer specifying the number of replicates used in the
          Monte Carlo test. Defaults to 10000.}
  \item{R}{Number of bootstrap iterations to use when computing the
          confidence interval. Defaults to 1000.}
  \item{correct}{see \code{\link{diseq.ci}}.}
  \item{conf}{Confidence level to use when computing the confidence level
          for linkage disequilibrium measures.  Defaults to 0.95, should be in (0,1).}
  \item{na.rm}{logical. Should missing values be removed?}
  \item{founderOnly}{Indicates if only founders are used to do the test.}
  \item{...}{
  othere arguments used by the function \code{\link[stats]{chisq.test}}.
  }
}
\value{
The function \code{HWE} returns a list:
  \item{\dQuote{diseq}}{a character string.}
  \item{call}{the matched call.}

  \item{\dQuote{D}}{a matrix with $m$ rows and $3+p$ columns, where $m$ is the number of markers in the geneSet, $p$ is the number of elements of the argument \code{conf}. The first column is the estimated \dQuote{D}. The next $p$ columns are estimated confidence limits for the confidence levels specified in the argument \code{conf}. The last two columns are the sample size and the p-value of the test that \dQuote{D} is equal to zero.}

  \item{\dQuote{D'}}{a matrix with $m$ rows and $3+p$ columns, where $m$ is the number of markers in the geneSet, $p$ is the number of elements of the argument \code{conf}. The first column is the estimated \dQuote{D'}. The next $p$ columns are estimated confidence limits for the confidence levels specified in the argument \code{conf}. The last two columns are the sample size and the p-value of the test that \dQuote{D'} is equal to zero.}

  \item{\dQuote{r}}{a matrix with $m$ rows and $3+p$ columns, where $m$ is the number of markers in the geneSet, $p$ is the number of elements of the argument \code{conf}. The first column is the estimated \dQuote{r}. The next $p$ columns are estimated confidence limits for the confidence levels specified in the argument \code{conf}. The last two columns are the sample size and the p-value of the test that \dQuote{r} is equal to zero.}

  \item{\dQuote{X$^2$}}{a matrix with $m$ rows and $3+p$ columns, where $m$ is the number of markers in the geneSet, $p$ is the number of elements of the argument \code{conf}. The first column is the test statistic \dQuote{X$^2$} for HWE test. The next $p$ columns are zeros. The last two columns are the sample size and the p-value of the test for Hardy-Weinberg equilibrium.}
}
\author{Gregory R. Warnes \email{gregory.r.warnes@pfizer.com} and Nitin Jain \email{nitin.jain@pfizer.com}}
\examples{
library(GeneticsBase)
data(CAMP)

HWE(CAMP)

} 
\keyword{misc}