Learn R Programming

FDX (version 2.0.0)

direct.discrete: Direct Application of Multiple Testing Procedures to Dataset

Description

Apply the [DLR], [NDLR], [DGR], [NDGR], [PB] or [NPB] procedure, with or without computing the critical constants, to a data set of 2x2 contingency tables using a hypothesis test function from package DiscreteTests.

Usage

direct.discrete.LR(
  dat,
  test.fun,
  test.args = NULL,
  alpha = 0.05,
  zeta = 0.5,
  direction = "su",
  adaptive = FALSE,
  critical.values = FALSE,
  select.threshold = 1,
  preprocess.fun = NULL,
  preprocess.args = NULL
)

direct.discrete.GR( dat, test.fun, test.args = NULL, alpha = 0.05, zeta = 0.5, adaptive = FALSE, critical.values = FALSE, select.threshold = 1, preprocess.fun = NULL, preprocess.args = NULL )

direct.discrete.PB( dat, test.fun, test.args = NULL, alpha = 0.05, zeta = 0.5, adaptive = FALSE, critical.values = FALSE, exact = TRUE, select.threshold = 1, preprocess.fun = NULL, preprocess.args = NULL )

Arguments

dat

input data; must be suitable for the first parameter of the provided preprocess.fun function or, if preprocess.fun = NULL, for the first parameter of the test.fun function.

test.fun

function from package DiscreteTests, i.e. one whose name ends with *_test_pv and which performs hypothesis tests and provides an object with p-values and their support sets; can be specified by a single character string (which is automatically checked for being a suitable function from that package and may be abbreviated) or a single function object.

test.args

optional named list with arguments for test.fun; the names of the list fields must match the test function's parameter names. The first parameter of the test function (i.e. the data) MUST NOT be included!

alpha

single real number strictly between 0 and 1 specifying the target FDP.

zeta

single real number strictly between 0 and 1 specifying the target probability of not exceeding the desired FDP. If zeta = NULL (the default), then zeta is chosen equal to alpha.

direction

single character string specifying whether to perform the step-up ("su) or step-down ("sd"; the default) version of the Lehmann-Romano procedure.

adaptive

single boolean indicating whether to conduct an adaptive procedure or not.

critical.values

single boolean indicating whether critical constants are to be computed.

select.threshold

single real number strictly between 0 and 1 indicating the largest raw p-value to be considered, i.e. only p-values below this threshold are considered and the procedures are adjusted in order to take this selection effect into account; if threshold = 1 (the default), all raw p-values are selected.

preprocess.fun

optional function for pre-processing the input data; its result must be suitable for the first parameter of the test.fun function.

preprocess.args

optional named list with arguments for preprocess.fun; the names of the list fields must match the pre-processing function's parameter names. The first parameter of the test function (i.e. the data) MUST NOT be included!

exact

single boolean indicating whether to compute the Poisson-Binomial distribution exactly or by normal approximation.

Examples

Run this code
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

# Construction of the p-values and their supports with Fisher's exact test
library(DiscreteTests)  # for Fisher's exact test
test.results <- fisher_test_pv(df)
raw.pvalues <- test.results$get_pvalues()
pCDFlist <- test.results$get_pvalue_supports()

# DLR
DLR.sd <- direct.discrete.LR(df, "fisher")
summary(DLR.sd)

# Non-adaptive DLR (step-up variant; adjusted p-values do not exist here!)
NDLR.su <- direct.discrete.LR(df, "fisher", direction = "su", adaptive = FALSE)
summary(NDLR.su)

# DGR
DGR <- direct.discrete.GR(df, "fisher")
summary(DGR)

# Non-adaptive DGR
NDGR <- direct.discrete.GR(df, "fisher", adaptive = FALSE)
summary(NDGR)

# DPB (normal approximation)
PB.approx <- direct.discrete.PB(df, "fisher", exact = FALSE)
summary(DGR)

# Non-adaptive DPB
NPB.exact <- direct.discrete.GR(df, "fisher", adaptive = FALSE)
summary(NDGR)

Run the code above in your browser using DataLab