xtest: Performs an exact test with full enumeration for...

Description Usage Arguments Value References See Also

View source: R/xtest.R


Given a set of genotype counts, xtest examines all possible outcomes with the same set of allele counts. For each table, it computes four test statistics and compares them with the observed values. It returns the total probability of all tables with test statistics as “extreme” or more so than the observed. It can also plot a histogram of one of the statitistics if histobins is greater than zero. More about these four test statistics and other information can be found in the vignette. This function will not normally be called directly. Instead, hwx.test calls either xtest or mtest depending on which method is to be used.


xtest(c, statName = "LLR", histobins = 0, histobounds = c(0, 0),
  showCurve = T, safeSecs = 100, detail = 2)



A matrix containing the genotype counts. It should be a square matrix, but only the lower-left half is used.


can be “LLR”, “Prob”, “U”, or “Chisq” depending on which one is to be ploted. Note that P values for all four are computed regardless of which one is specified with this parameter.


If 0 no histogram is plotted. If 1 or TRUE a histogram with 500 bins is plotted. If set to a number greater than 1, a histogram with histobins is plotted.


A vector containing the left and right boundaries for the histogram's x axis. If you leave this as the default, c(0,0), then xtest will compute reasonable bounds to include most of the distribution.


whether to show a blue curve indicating the asymptotic (chi squared) distribution. This only works for LLR and Chisq


After this many seconds the calculation will be aborted. This is a safety valve to prevent attempts to compute impossibly large sets of tables.


Determines how much detail is printed. If set to 0, nothing is printed (useful if you use xtest programmatically.).


xtest returns a list components

$ Pvalues

The four computed P values corresponding to the test statistics: LLR, Prob, U and Chisq in that order.

$ observed

The four observed statistics in the same order as above

$ tableCount

The number of tables examined during the calculation

$ ntrials


$ genotypes

The input matrix of genotype counts

$ alleles

The allele counts m corresponding to the input genotype counts

$ statID

Which test statistic was used if a histogram was plotted

$ histobins

If greater than zero, the number of bins to use for the histogram

$ histobounds

The lower and upper limits of the test statistic in the histogram

$ histoData

Vector of histobins values for the histogram

$ showCurve

Whether the asymptotic curve should be plotted with the histogram


The methods are described by Engels, 2009. Genetics 183:1431.

See Also


HWxtest documentation built on May 29, 2017, 3:33 p.m.