File: maxstat-bugs.R

package info (click to toggle)
r-cran-maxstat 0.7-25-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 332 kB
  • sloc: ansic: 331; sh: 51; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

library("maxstat")
library("exactRankTests")
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")
# this one failed: QUANT not known
maxstat.test(y ~ index, data=mydata)

# 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
set.seed(290875)
b <- maxstat.test(y ~ x, data=mydata, smethod="Wilcoxon", pmethod="condMC", 
             B = 9999, alpha = 0.9)$p.value
b
stopifnot(all.equal(a, b))