DiscreteFDR (version 1.1)

fast.Discrete: Fast application of discrete procedures

Description

Apply the [HSU], [HSD], [AHSU] or [AHSD] procedure, without computing the critical constants, to a data set of 2 x 2 contingency tables using Fisher's exact tests.

Usage

fast.Discrete(counts, alternative = "greater", input = "noassoc",
  alpha = 0.05, direction = "su", adaptive = FALSE, bigMem = FALSE,
  verbose = FALSE)

Arguments

counts

a data frame of 2 or 4 columns and any number of lines, each line representing a 2 x 2 contingency table to test. The number of columns and what they must contain depend on the value of the input argument, see Details of fisher.pvalues.support.

alternative

same argument as in fisher.test. The three possible values are "greater" (default), "two.sided" or "less" and you can specify just the initial letter.

input

the format of the input data frame, see Details of fisher.pvalues.support. The three possible values are "noassoc" (default), "marginal" or "HG2011" and you can specify just the initial letter.

alpha

the target FDR level, a number strictly between 0 and 1.

direction

a character string specifying whether to conduct a step-up (direction="su", by default) or step-down procedure (direction="sd").

adaptive

a boolean specifying whether to conduct an adaptive procedure or not.

bigMem

a boolean. If TRUE, the code uses matrixes and functions of the apply family as far as possible (faster for small number of hypotheses and support size, but slower otherwise due to memory management overhead). If FALSE, computations are done with for loops and chunks to conserve memory.

verbose

a boolean indicating if msg must be printed. Used when bigMem=TRUE, to print messages informing if in-memory computation was successful or if loops and chunks were used as fallback.

Value

A list whose elements are:

Rejected

rejected raw p-values

Indices

indices of rejected hypotheses

Max.k

number of rejections

Alpha

maximum significance level for which a rejection occured, that is \(Alpha = alpha * Max.k / m\)

Adjusted

adjusted p-values (only for step-down direction).

Details

This version: 2018-08-21.

Examples

Run this code
# NOT RUN {
X1 <- c(4, 2, 2, 14, 6, 9, 4, 0, 1)
X2 <- c(0, 0, 1, 3, 2, 1, 2, 2, 2)
N1 <- rep(148, 9)
N2 <- rep(132, 9)
Y1 <- N1-X1
Y2 <- N2-X2
df <- data.frame(X1,Y1,X2,Y2)
df

DBH.su <- fast.Discrete(counts=df, input="noassoc", direction="su")
DBH.sd <- fast.Discrete(counts=df, input="noassoc", direction="sd")
DBH.sd$Adjusted
ADBH.su <- fast.Discrete(counts=df, input="noassoc", direction="su", adaptive=TRUE)
ADBH.sd <- fast.Discrete(counts=df, input="noassoc", direction="sd", adaptive=TRUE)
ADBH.sd$Adjusted

# }

Run the code above in your browser using DataCamp Workspace