direct_discrete_FWER {DiscreteFWER} | R Documentation |
Direct Application of Multiple Testing Procedures to Dataset
Description
Apply one of the various FWER adaptation procedures, with or without
computing the critical constants, to a data set of 2x2 contingency tables
using statistical test functions from package
DiscreteTests
. If necessary,
functions for pre-processing can be passed as well.
Usage
direct_discrete_FWER(
dat,
test_fun,
test_args = NULL,
alpha = 0.05,
independence = FALSE,
single_step = TRUE,
critical_values = FALSE,
select_threshold = 1,
preprocess_fun = NULL,
preprocess_args = NULL
)
Arguments
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 indicating the target FWER level. |
independence |
single boolean specifying whether the |
single_step |
single boolean specifying whether to perform a single-step ( |
critical_values |
single boolean specifying whether critical constants are to be computed. |
select_threshold |
single real number strictly between 0 and 1 indicating the largest raw |
preprocess_fun |
optional function for pre-processing the input |
preprocess_args |
optional named list with arguments for |
Value
A DiscreteFWER
S3 class object whose elements are:
Rejected |
rejected raw |
Indices |
indices of rejected hypotheses. |
Num_rejected |
number of rejections. |
Adjusted |
adjusted |
Critical_constants |
critical values (only exists if computations where performed with |
Data |
list with input data. |
Data$Method |
character string describing the performed algorithm, e.g. 'Discrete Bonferroni procedure'. |
Data$Raw_pvalues |
observed |
Data$pCDFlist |
list of the |
Data$FWER_level |
FWER level |
Data$Independence |
boolean indicating whether the |
Data$Single_step |
boolean indicating whether a single-step or step-down procedure was performed. |
Data$Data_name |
the respective variable names of the input data. |
Select |
list with data related to |
Select$Threshold |
|
Select$Effective_Thresholds |
results of each |
Select$Pvalues |
selected |
Select$Indices |
indices of |
Select$Scaled |
scaled selected |
Select$Number |
number of selected |
Examples
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
# Computation of 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()
DBonf <- direct_discrete_FWER(df, "fisher")
summary(DBonf)
DHolm <- direct_discrete_FWER(df, "fisher_test_pv", single_step = FALSE)
summary(DHolm)
DBonf_bin <- direct_discrete_FWER(X1 + X2, "binom_test_pv",
list(n = N1 + N2, p = 0.05))
summary(DBonf_bin)
DHolm_bin <- direct_discrete_FWER(X1 + X2, "binom",
list(n = N1 + N2, p = 0.05),
single_step = TRUE)
summary(DHolm_bin)