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

sage.test

Exact Binomial Tests For Comparing Two SAGE Libraries (Obsolete)


Description

Computes p-values for differential abundance for each tag between two digital libraries, conditioning on the total count for each tag. The counts in each group as a proportion of the whole are assumed to follow a binomial distribution.

Usage

sage.test(x, y, n1=sum(x), n2=sum(y))

Arguments

x

integer vector giving counts in first library. Non-integer values are rounded to the nearest integer.

y

integer vector giving counts in second library. Non-integer values are rounded to the nearest integer.

n1

total number of tags in first library. Non-integer values are rounded to the nearest integer.

n2

total number of tags in second library. Non-integer values are rounded to the nearest integer.

Details

This function was originally written for comparing SAGE libraries (a method for counting the frequency of sequence tags in samples of RNA). It can however be used for comparing any two digital libraries from RNA-Seq, ChIP-Seq or other technologies with respect to technical variation.

An exact two-sided binomial test is computed for each tag. This test is closely related to Fisher's exact test for 2x2 contingency tables but, unlike Fisher's test, it conditions on the total number of counts for each tag. The null hypothesis is that the expected counts are in the same proportions as the library sizes, i.e., that the binomial probability for the first library is n1/(n1+n2).

The two-sided rejection region is chosen analogously to Fisher's test. Specifically, the rejection region consists of those values with smallest probabilities under the null hypothesis.

When the counts are reasonably large, the binomial test, Fisher's test and Pearson's chisquare all give the same results. When the counts are smaller, the binomial test is usually to be preferred in this context.

This function is a later version of the earlier sage.test function in the sagenhaft Bioconductor package. This function has been made obsolete by binomTest in the edgeR package.

Value

Numeric vector of p-values.

Note

This function is kept in the statmod package so as not to break code that depends on it but it has been replaced by binomTest in the edgeR Bioconductor package and is no longer updated. It may be removed in a later release of this package.

Author(s)

Gordon Smyth

References

See Also

The binomTest function in the edgeR package on Bioconductor is a newer and better version of this function.

binom.test in the stats package performs univariate binomial tests.

Examples

sage.test(c(0,5,10),c(0,30,50),n1=10000,n2=15000)
#  Univariate equivalents:
binom.test(5,5+30,p=10000/(10000+15000))$p.value
binom.test(10,10+50,p=10000/(10000+15000))$p.value

statmod

Statistical Modeling

v1.4.36
GPL-2 | GPL-3
Authors
Gordon Smyth [cre, aut], Yifang Hu [ctb], Peter Dunn [ctb], Belinda Phipson [ctb], Yunshun Chen [ctb]
Initial release
2021-05-10

We don't support your browser anymore

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