Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = c(1, 4, 7, 3, 11, 6); x
- [1] 1 4 7 3 11 6
- rank(x)
- [1] 1 3 5 2 6 4
- y = c(1, 4, 6, 2, 4, 6, 11); y
- [1] 1 4 6 2 4 6 11
- rank(y)
- [1] 1.0 3.5 5.5 2.0 3.5 5.5 7.0
- x = c(1, 2, 2, 4, 5, 3, 0); y = c(4, 6, 3, 8, 11, 11)
- wilcox.test(x, y)
- Wilcoxon rank sum test with continuity correction
- data: x and y
- W = 4, p-value = 0.01778
- alternative hypothesis: true location shift is not equal to 0
- Warning message:
- In wilcox.test.default(x, y) : cannot compute exact p-value with ties
- jx = runif(length(x), -.01, .01); jy = runif(length(y), -.01, .01)
- wilcox.test(x+jx, y+jy)
- Wilcoxon rank sum test
- data: x + jx and y + jy
- W = 4, p-value = 0.01399
- alternative hypothesis: true location shift is not equal to 0
- x; rank(x)
- [1] 1 2 2 4 5 3 0
- [1] 2.0 3.5 3.5 6.0 7.0 5.0 1.0
- round(x+jx, 4); rank(x+jx)
- [1] 0.9958 1.9900 2.0035 3.9945 5.0093 2.9995 -0.0095
- [1] 2 3 4 6 7 5 1
Add Comment
Please, Sign In to add comment