BIO 232 Permutation test

References

Load packages

## superceded by coin package
library(exactRankTests)

Permutation tests

recovery <- c(19,22,25,26,23,33,40)
trt <- c(1,1,1,1,2,2,2)

perm.test(recovery ~ trt, exact = TRUE, conf.int = TRUE, alternative = "less")
## Warning in perm.test.default(x = c(19, 22, 25, 26), y = c(23, 33, 40), exact = TRUE, : x has more observations than
## y, returning perm.test(y, x, ...)
## 
##  2-sample Permutation Test
## 
## data:  recovery by trt
## T = 96, p-value = 0.9429
## alternative hypothesis: true mu is less than 0
## 95 percent confidence interval:
##   -2 Inf
perm.test(recovery ~ trt, exact = TRUE, conf.int = TRUE, alternative = "two.sided")
## Warning in perm.test.default(x = c(19, 22, 25, 26), y = c(23, 33, 40), exact = TRUE, : x has more observations than
## y, returning perm.test(y, x, ...)
## 
##  2-sample Permutation Test
## 
## data:  recovery by trt
## T = 96, p-value = 0.1143
## alternative hypothesis: true mu is not equal to 0
## 95 percent confidence interval:
##  -3 18
wscores <- cscores(recovery, type = "Wilcoxon")
perm.test(wscores ~ trt, exact = TRUE, alternative = "two.sided")
## 
##  2-sample Permutation Test
## 
## data:  wscores by trt
## T = 12, p-value = 0.2286
## alternative hypothesis: true mu is not equal to 0
perm.test(wscores ~ trt, exact = TRUE, conf.int = TRUE, alternative = "two.sided")
## Warning in perm.test.default(x = c(1, 2, 4, 5), y = c(3, 6, 7), exact = TRUE, : x has more observations than y,
## returning perm.test(y, x, ...)
## 
##  2-sample Permutation Test
## 
## data:  wscores by trt
## T = 16, p-value = 0.2286
## alternative hypothesis: true mu is not equal to 0
## 95 percent confidence interval:
##  -2  5