# intern.crude: Internal function In globalSeq: Global Test for Counts

## Description

Using the parameter estimates `mu` and `phi` and the permutation matrix `perm`, these functions tests for global association between `y` and `X`. The function `intern.crude` calculates p-values by permutation (without repetitions). The functions `intern.focus` and `intern.conva` use different tricks to increase precision and decrease computational expense.

## Usage

 ```1 2 3 4 5``` ```intern.crude(y, X, mu, phi, perm) intern.focus(y, X, mu, phi, perm, focus) intern.conva(y, X, mu, phi, perm, offset) ```

## Arguments

 `y` response variable: numeric vector of length `n` `X` covariate set: numeric matrix with `n` rows (samples) and `p` columns (covariates) `mu` mean parameters: numeric vector of length `n` `phi` dispersion parameter: non-negative real number `perm` permutations: matrix with `n` rows (see example) `focus` number between 0 and 1 `offset` numeric vector of length `n`

## Details

The function `intern.focus` uses permutations in chunks. If the remaining permutations do not allow to reach a specified significance level, it stops and rounds the p-value to one.

The function `intern.conva` uses the method of control variates from Senchaudhuri et al. (1995). Roughly speaking, if the test statistics from Rauschenberger et al. (2016) and Goeman et al. (2004) are highly correlated, it returns the asymptotic p-value from Goeman et al. (2004).

## Value

Each function returns a dataframe, with the p-value in the first row, and the test statistic in the second row.

## References

P Senchaudhuri, CR Mehta, and NR Patel (1995). "Estimating exact p values by the method of control variates or Monte Carlo rescue", Journal of the American Statistical Association. 90:640-648 html pdf (restricted access)

A Rauschenberger, MA Jonker, MA van de Wiel, and RX Menezes (2016). "Testing for association between RNA-Seq and high-dimensional data", BMC Bioinformatics. 17:118. html pdf (open access)

JJ Goeman, SA van de Geer, F de Kort, and HC van Houwelingen (2004). "A global test for groups of genes: testing association with a clinical outcome", Bioinformatics. 20:93-99. html pdf (open access)

These are `internal` functions. The user functions of the R package `globalSeq` are `cursus`, `omnibus`, and `proprius`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```# simulate high-dimensional data n <- 30 p <- 100 # set.seed(1) y <- rnbinom(n,mu=10,size=1/0.25) X <- matrix(rnorm(n*p),nrow=n,ncol=p) # prepare arguments mu <- rep(mean(y),n) phi <- (var(y)-mu)/mu^2 perm <- intern.permu(n=n,it=99,group=NULL,kind=1) # perform tests intern.crude(y,X,mu,phi,perm) intern.focus(y,X,mu,phi,perm,focus=0.01) intern.conva(y,X,mu,phi,perm,NULL) ```