Trying to understand when to use which test, am I correct when saying both these tests, test whether two samples could be taken from the same distribution, but the difference is that the student's t-test assumes that the distributions that are tested have a normal distribution (Gauss distribution), while the Wilcoxon signed-rank test accept any type of distribution?
1 Answer
There are three t-tests:
- One sample
- Independent samples
- Paired samples
Since Wilcoxon signed rank is about paired samples, I will assume you are comparing it to a paired sample t-test.
The paired sample t-test does not assume the distributions are normal, it assumes the differences are normal. Then it sees if the differences are different from 0 (usually; it is possible to change this); essentially. Wilcoxon, on the other hand, tests whether the mean ranks are different.
Neither one tests the rather general proposition that you state: "from the same population". For instance, suppose you have two samples, both from populations with mean = 10, but one with sd = 2, the other with sd = 100. Neither t nor Wilcoxon will show a difference:
set.seed(1234)
x1 <- rnorm(1000, 10, 2) #Normal, mean = 10, sd = 2, N = 1000
x2 <- rnorm(1000, 10, 10) #Normal, mean = 10, sd = 1-0, N = 1000
t.test(x1, x2, paired = TRUE) #t = -0.32, df = 999, p = 0.53
wilcox.test(x1, x2, paired = TRUE) #V = 243625 p = 0.40
You could even have much more different distributions:
x3 <- runif(1000, 0, 20)
t.test(x1, x3, paired = TRUE) #t = 1.25, df = 999, p = 0.21
wilcox.test(x1, x3, paired = TRUE) #V = 242525 p = 0.40
But if you do plot any pair of variables, you will see they are very different. E.g.
boxplot(x1, x2)
qqplot(x1,x2)
abline(a = 0, b = 1)