direct.discrete | R Documentation |
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.
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
)
dat |
input data; must be suitable for the first parameter
of the provided |
test.fun |
function from package
|
test.args |
optional named list with arguments for |
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 |
direction |
single character string specifying whether to perform the step-up ( |
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 |
preprocess.fun |
optional function for pre-processing the input
|
preprocess.args |
optional named list with arguments for
|
exact |
single boolean indicating whether to compute the Poisson-Binomial distribution exactly or by normal approximation. |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.