The differences of P-values in t test assuming equal or...

For the test of means of two samples, we calculated the P-values and recorded the counts of Tukey's rule of thumb.

A data frame with 10000 observations on the following 3 variables.

- pvalue.t
P-values of t test

- pvalue.w
P-values of Wilcoxon test

- count
Tukey's counts

See the reference for details.

Simulation; see the Examples section below.

D. Daryl Basler and Robert B. Smawley. Tukey's Compact versus
Classic Tests. *The Journal of Experimental Education*, Vol. 36, No.
3 (Spring, 1968), pp. 86-88

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 34 35 36 | ```
data(tukeyCount)
## does Tukey's rule of thumb agree with t test and Wilcoxon test?
with(tukeyCount, {
ucount = unique(count)
stripchart(pvalue.t ~ count, method = "jitter", jitter = 0.2, pch = 19,
cex = 0.7, vertical = TRUE, at = ucount - 0.2, col = rgb(1, 0, 0, 0.2),
xlim = c(min(count) - 1, max(count) + 1), xaxt = "n", xlab = "Tukey Count",
ylab = "P-values")
stripchart(pvalue.w ~ count, method = "jitter", jitter = 0.2, pch = 21,
cex = 0.7, vertical = TRUE, at = ucount + 0.2, add = TRUE, col = rgb(0,
0, 1, 0.2), xaxt = "n")
axis(1, unique(count))
lines(sort(ucount), tapply(pvalue.t, count, median), type = "o", pch = 19,
cex = 1.3, col = "red")
lines(sort(ucount), tapply(pvalue.w, count, median), type = "o", pch = 21,
cex = 1.3, col = "blue", lty = 2)
legend("topright", c("t test", "Wilcoxon test"), col = c("red", "blue"),
pch = c(19, 21), lty = 1:2, bty = "n", cex = 0.8)
})
if (interactive()) {
## this is how the data was generated
set.seed(402)
n = 30
tukeyCount = data.frame(t(replicate(10000, {
x1 = rweibull(n, runif(1, 0.5, 4))
x2 = rweibull(n, runif(1, 1, 5))
c(t.test(x1, x2)$p.value, wilcox.test(x1, x2)$p.value, with(rle(rep(0:1,
each = n)[order(c(x1, x2))]), ifelse(head(values, 1) == tail(values,
1), 0, sum(lengths[c(1, length(lengths))]))))
})))
colnames(tukeyCount) = c("pvalue.t", "pvalue.w", "count")
}
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.