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()
# Non-adaptive DPB (exact) without critical values; using results object
NDPB.exact.fast <- NDPB(test.results)
summary(NDPB.exact.fast)
# Non-adaptive DPB (exact) with critical values; using extracted p-values and supports
NDPB.exact.crit <- NDPB(raw.pvalues, pCDFlist, critical.values = TRUE)
summary(NDPB.exact.crit)
# Non-adaptive DPB (normal approx.) without critical values; using extracted p-values and supports
NDPB.norm.fast <- NDPB(raw.pvalues, pCDFlist, exact = FALSE)
summary(NDPB.norm.fast)
# Non-adaptive DPB (normal approx.) with critical values; using test results object
NDPB.norm.crit <- NDPB(test.results, critical.values = TRUE, exact = FALSE)
summary(NDPB.norm.crit)
Run the code above in your browser using DataLab