Learn R Programming

FDX (version 2.0.0)

fast.Discrete: Fast application of discrete procedures

Description

[Deprecated]

Applies the [DLR], [DGR] or [DPB] procedures, without computing the critical values, to a data set of 2 x 2 contingency tables using Fisher's exact test.

Note: These functions are deprecated and will be removed in a future version. Please use direct.discrete.*() with test.fun = DiscreteTests::fisher.test.pv and (optional) preprocess.fun = DiscreteDatasets::reconstruct_two or preprocess.fun = DiscreteDatasets::reconstruct_four instead. Alternatively, use a pipeline like
data |>
DiscreteDatasets::reconstruct_*(<args>) |>
DiscreteTests::*.test.pv(<args>) |>
discrete.*(<args>).

Usage

fast.Discrete.LR(
  counts,
  alternative = "greater",
  input = "noassoc",
  alpha = 0.05,
  zeta = 0.5,
  direction = "sd",
  adaptive = TRUE
)

fast.Discrete.GR( counts, alternative = "greater", input = "noassoc", alpha = 0.05, zeta = 0.5, adaptive = TRUE )

fast.Discrete.PB( counts, alternative = "greater", input = "noassoc", alpha = 0.05, zeta = 0.5, adaptive = TRUE, exact = FALSE )

Value

A FDX S3 class object whose elements are:

Rejected

rejected raw \(p\)-values.

Indices

indices of rejected \(p\)-values.

Num.rejected

number of rejections.

Adjusted

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

Critical.values

critical values (only exists if computations where performed with critical.values = TRUE).

Select

list with data related to \(p\)-value selection; only exists if threshold < 1.

Select$Threshold

\(p\)-value selection threshold.

Select$Effective.Thresholds

results of each \(p\)-value CDF evaluated at the selection threshold.

Select$Pvalues

selected \(p\)-values that are \(\leq\) selection threshold.

Select$Indices

indices of \(p\)-values \(\leq\) selection threshold.

Select$Scaled

scaled selected \(p\)-values.

Select$Number

number of selected \(p\)-values \(\leq\) threshold.

Data

list with input data.

Data$Method

character string describing the used algorithm, e.g. 'Discrete Lehmann-Romano procedure (step-up)'.

Data$Raw.pvalues

all observed raw \(p\)-values.

Data$FDP.threshold

FDP threshold alpha.

Data$Exceedance.probability

probability zeta of FDP exceeding alpha; thus, FDP is being controlled at level alpha with confidence 1 - zeta.

Data$Adaptive

boolean indicating whether an adaptive procedure was conducted or not.

Data$Data.name

the respective variable name(s) of the input data.

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 DiscreteFDR::fisher.pvalues.support().

alternative

same argument as in fisher.test(). The three possible values are "greater" (default), "two.sided" or "less"; may be abbreviated.

input

the format of the input data frame, see Details of DiscreteFDR::fisher.pvalues.support(). The three possible values are "noassoc" (default), "marginal" or "HG2011"; may be abbreviated.

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.

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

# DLR
DLR.sd <- fast.Discrete.LR(counts = df, input = "noassoc")
summary(DLR.sd)

# DLR
DLR.su <- fast.Discrete.LR(counts = df, input = "noassoc", direction = "su")
summary(DLR.su)

# Non-adaptive DLR
NDLR.sd <- fast.Discrete.LR(counts = df, input = "noassoc", adaptive = FALSE)
summary(NDLR.sd)

# Non-adaptive DLR
NDLR.su <- fast.Discrete.LR(counts = df, input = "noassoc", direction = "su", adaptive = FALSE)
summary(NDLR.su)

# DGR
DGR <- fast.Discrete.GR(counts = df, input = "noassoc")
summary(DGR)

# Non-adaptive DGR
NDGR <- fast.Discrete.GR(counts = df, input = "noassoc", adaptive = FALSE)
summary(NDGR)

# DPB
DPB <- fast.Discrete.PB(counts = df, input = "noassoc")
summary(DPB)

# Non-adaptive DPB
NDPB <- fast.Discrete.PB(counts = df, input = "noassoc", adaptive = FALSE)
summary(NDPB)

Run the code above in your browser using DataLab