gofTest: Test the goodness of fit of every row in a matrix of counts

Description Usage Arguments Details Value References See Also Examples

View source: R/gofTest.R

Description

Function to test the goodness of fit of every row in a matrix of counts

Usage

1
gofTest(counts, a = 0, mc.cores = 1)

Arguments

counts

matrix of counts

a

numeric scalar smaller than 1. The function will test whether the shape parameter is equal to the introduced 'a' (default is 0).

mc.cores

number of cpu cores to be used. This option is only available when the 'multicore' package is installed and loaded first. In such a case, if the default value of mc.cores=1 is not changed, all available cores will be used.

Details

By default a = 0, and therefore the function tests for every row of the input matrix of counts whether the count data follows a Negative-Binomial distribution. In this case, a Likelihood Ratio Test is performed. When the given value for 'a' is different from 0, a Wald test is performed. This function calls testShapePT.

Value

a vector of statistics that follows a χ^2 distribution with one degree of freedom under the null hypothesis.

References

Esnaola M, Puig P, Gonzalez D, Castelo R and Gonzalez JR (2013). A flexible count data model to fit the wide diversity of expression profiles arising from extensively replicated RNA-seq experiments. BMC Bioinformatics 14: 254

A.H. El-Shaarawi, R. Zhu, H. Joe (2010). Modelling species abundance using the Poisson-Tweedie family. Environmetrics 22, pages 152-164.

P. Hougaard, M.L. Ting Lee, and G.A. Whitmore (1997). Analysis of overdispersed count data by mixtures of poisson variables and poisson processes. Biometrics 53, pages 1225-1238.

See Also

testShapePT

Examples

1
2
3
4
5
6
7
8
9
## Generate a random matrix of counts
counts <- matrix(rPT(n=2000, a=0.5, mu=10, D=5), nrow=20)

## Perform the goodness-of-fit tests for every row in the matrix
chi2gof <- gofTest(counts)

## Calculate and sort the corresponding P-values for the
## null hypothesis that counts follow a negative binomial distribution
sort(pchisq(chi2gof, df=1, lower.tail=FALSE))

Example output

 [1] 6.150545e-05 3.547492e-04 2.508097e-02 3.031987e-02 6.132715e-02
 [6] 9.799692e-02 1.051269e-01 1.161962e-01 1.176889e-01 1.584903e-01
[11] 1.773903e-01 2.861552e-01 2.882200e-01 3.280658e-01 4.236746e-01
[16] 4.420108e-01 5.204521e-01 5.945177e-01 6.779848e-01 8.364026e-01

tweeDEseq documentation built on Nov. 8, 2020, 5:59 p.m.