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