Learn R Programming

hint (version 0.1-1)

hint.test: A Hypergeometric Intersection Test

Description

Apply the hypergeometric intersection test to categorical data to test for enrichment or depletion of intersections between two samples.

Usage

hint.test(cats, draw1, draw2, alternative = "greater")

Arguments

cats
A data frame or matrix with 3 columns; the first gives the category identifier, and the second and third give the number of balls belonging to this category in the first and second urns respectively.
draw1
A vector of objects corresponding to the categories given in cats drawn from the first urn.
draw2
A vector of objects corresponding to the categories given in cats drawn from the second urn.
alternative
A characer string specifying the hypothesis to be tested. Can be one of "greater", "less", or "two.sided".

Value

An object of class hint.test, which is a list containing the following components:
parameters
An integer vector giving the parameter values.
p.value
A numerical value giving the p-value associated with the test.
alternative
A character string naming the hypothesis that was tested.

Details

The hypergeometric intersection distributions describe the distribution of intersection sizes when sampling without replacement from two separate urns in which reside balls belonging to the same n object categories (see Hyperintersection).

References

Kalinka, A.T. (2013). The probability of drawing intersections: extending the hypergeometric distribution. arXiv.1305.0717

See Also

phint, hint.dist.test, plotDistr, plot.hint.test.

Examples

Run this code
## Build data input:
dd <- data.frame(letters[1:20], rep(1,20), rep(1,20))
hint.test(dd, letters[1:9], letters[4:14], alternative = "greater")

dd <- data.frame(letters[1:20], rep(1,20), c(rep(1,4),rep(2,16)))
hint.test(dd, letters[1:9], letters[4:14], alternative = "less")

Run the code above in your browser using DataLab