# Kolmogorov-Smirnov test vs. Wilcoxon signed-rank test for two samples

I would like to ask a question about the usage of Kolmogorov-Smirnov test and Wilcoxon signed-rank test to show that two samples have the same distribution (specifically, log-normal). Specifically, I have a sequence of measurements (at least 1000) and I would like to show that measurements have log-normal distributions. To do that, I want compute estimated mean and variance and use it in one of the tests.

In the literature, authors suggest to use Kolmogorov-Smirnov test. However, I would like to ask what if I use Wilcoxon signed-rank test to show that two samples have the same distribution? Can I use the resulting p-value to decide whether to reject $$H_0$$ hypothesis or not?

• Please edit your question to clarify: It seems you have two independent samples. Is the issue: (a) Whether they are both lognormal? or (b) Whether two samples known to be from lognormal populations have the same mean? variance? // If you are doing a two-sample test, you'd use Wilcoxon rank sum (AKA Mann-Whitney-Wilcoxon), not Wilcoxon signed rank test // Also please give aprx sample sizes. Jul 3, 2019 at 16:33
• In the situation where you know the data are lognormal, you would be better to test the equality of the log-means and the log-variances. Jul 3, 2019 at 17:36
• Your question seems to be trying to answer two very different questions. 1. Are each of the samples consistent with having been drawn from a lognormal population? or 2. Are the samples consistent with having been drawn from the same population, whatever that may be? Are you interested in Q1 or Q2? Or are you more interested in 3. Assuming I have samples drawn from lognormal populations, do they have same parameters? Jul 5, 2019 at 1:18

Nothing in your question indicates that a paired test like the Wilcoxon signed-rank test is appropriate.

KS would be a fairly standard to use for a two-sample distribution comparison. Wilcoxon is for checking location and can lack the sensitivity to distributions with the same location that differ in other ways, such as scale. Compare a standard normal and $$t_{2.1}$$ in a simulation. Here's some R code.

N <- 1000
times <- 1000
p.ks <- p.wi <- rep(NA,times)
set.seed(12)
for (i in 1:times){

y0 <- rt(N,2.1)
y1 <- rnorm(N,0,1)

p.wi[i] <- wilcox.test(y0,y1)$$p.value p.ks[i] <- ks.test(y0,y1)$$p.value
}
length(p.ks[p.ks<=0.05])/times
length(p.wi[p.wi<=0.05])/times


Wilcoxon can pick up on differences other than median when you have very different shapes, however, such as if you take:

y0 <- rexp(N,1)
y1 <- rnorm(N,log(2,base=exp(1)),1)


Run that in the same simulation. KS winds up being more sensitive, but Wilcoxon still does well. If you drop the sample size down to 100, KS kick's Wilcoxon's butt.

In summary, use KS (or some other general distribution comparison, such as Anderson-Darling) when you're interested in overall distribution differences, and use Wilcoxon when you are specifically interested in location differences.

In your case, I would use KS to tell if your two samples come from the same population distribution. That KS test alone won't tell you if that distribution is lognormal, however, though KS can compare an empirical distribution to a population distribution. Be careful about specifying the parameters of the population distribution, however, as it is poor practice to use the estimated parameters, tempting as that seems. You should know beforehand what parameters your population distribution follows.

• Unfortunately, I don't know exact parameters of the log-normal distribution (population distribution). I just use estimations of mean and variance computed from the measured sample. Are there any other ways to get better parameters? I also have one another question. I understood that Wilcoxon test has worse sensitivity when the shapes differ. But what about the fact that it is paired? Is it completely wrong to use it in non-paired setting? Thank you. Jul 4, 2019 at 11:35
• @rbtrht 1. There are known methods for testing normal distribution goodness-of-fit when you estimate the parameters (Lilliefors test). Perhaps you can scour the literature to find one for log-normal. I also wonder if you would find it valuable to discover that your populations are or are not lognoral. What if you just know that the empirical distributions come from the same population, even if you don't know the population?
– Dave
Jul 4, 2019 at 14:47
• 2. There's a Wilcoxon (Mann-Whitney) test for unpaired data $X_1,\dots,X_n$ versus $Y_1,\dots,Y_m$. The R command is "wilcox.test" (not "wilcoxon"). But the paired test is nonsense in the unpaired setting.
– Dave
Jul 4, 2019 at 14:47
• I just found another question on here that that has a response by Glen_b that is worth reading: stats.stackexchange.com/questions/45033/…
– Dave
Jul 4, 2019 at 15:18