R Under development (unstable) (2025-05-01 r88184 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library("maxstat") > library("exactRankTests") Package 'exactRankTests' is no longer under development. Please consider using package 'coin' instead. > set.seed(290875) > > # by Achim Zeileis, 13.09.2002 > y <- c(0.9, 1, 0.8, 0.8, 0.85, 0.3, 0.2, 0.2, 0.1, 0.2, 0.3) > index <- 1:length(y) > mydata <- data.frame(cbind(y, index)) > maxstat.test(y ~ index, data=mydata, smethod = "Wilcoxon", pmethod = "HL") Maximally selected Wilcoxon statistics using HL data: y by index M = 2.7767, p-value < 2.2e-16 sample estimates: estimated cutpoint 5 > # this one failed: QUANT not known > maxstat.test(y ~ index, data=mydata) Maximally selected Wilcoxon statistics using none data: y by index M = 2.7767, p-value = NA sample estimates: estimated cutpoint 5 > > # spotted and fixed 16.09.2002 > y <- rnorm(20) > x <- factor(c(rep(0,10), rep(1,10))) > mydata <- data.frame(cbind(y,x)) > a <- maxstat.test(y ~ x, data=mydata, smethod="Wilcoxon", pmethod="HL") > b <- wilcox.exact(y ~ x, data=mydata) > stopifnot(all.equal(a$p.value, b$p.value)) > > # check new conditional Monte-Carlo p-values > > set.seed(290875) > a <- maxstat.test(y ~ x, data=mydata, smethod="Wilcoxon", pmethod="condMC", + B = 9999)$p.value > a [1] 0.9150915 > set.seed(290875) > b <- maxstat.test(y ~ x, data=mydata, smethod="Wilcoxon", pmethod="condMC", + B = 9999, alpha = 0.9)$p.value > b [1] 0.9150915 > stopifnot(all.equal(a, b)) > > > proc.time() user system elapsed 0.18 0.15 0.32