# Appropriate median test

##### New Member
What is the appropriate non-parameteic test for comparing the medians of two groups independent from each other?

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Most people use the Wilcoxon rank sum test. Given your sample size, the exact version of the test may be used to compare medians.

Given the distribution of your data, transformations can be used at times in order to use parametric tests.

##### New Member
Most people use the Wilcoxon rank sum test. Given your sample size, the exact version of the test may be used to compare medians.

Given the distribution of your data, transformations can be used at times in order to use parametric tests.
So, what non-parametric test is used to compare the "means" of two independent groups?? I've been tough that Wilcoxon is used for means! Not for medians!

#### obh

##### Well-Known Member
The Wilcoxon rank-sum test also called Mann–Whitney U test compared the entire distributions.
When the two groups have a similar distribution curve you can say it compares also the medians. If symmetrical median equals mean ...so you can say it also compares the means.

##### New Member
The Wilcoxon rank-sum test also called Mann–Whitney U test compared the entire distributions.
When the two groups have a similar distribution curve you can say it compares also the medians. If symmetrical median equals mean ...so you can say it also compares the means.
And, when they are not symmetric, what test is used for means and what test for medians?

#### obh

##### Well-Known Member
Actually I wasn't correct...the mean also treat the entire distribution but in a different way.
If the Wilcoxon rank-sum test says one group is "bigger" than the other it says that the probability to get higher value from this group is higher, while the mean says that in the long run if you will do it, again and again, you will get a higher sum from all the repetitions.

In the attached example:
1. A : B - The median of group A and Group B is the same, but it is very clear that the probability to get higher value from group B is higher.
2. B : C - THe probability to get higher value from group B is higher but on average you will get more in group C Last edited:

#### obh

##### Well-Known Member
And, when they are not symmetric, what test is used for means and what test for medians?
If they are not symmetric but with a similar shape, the Wilcoxon rank-sum test will also compare the medians.
T-test is used to compare the means, for not normal data if the sample size is large enough you can still use the t-test (CLT)
It is not sensitive to the violation of the normality assumption.

What is large enough? usually, say 30.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Side note, if you just want to compare medians, this can also be done with quantile regression, which can adjust for covariates as well.

#### Karabiner

##### TS Contributor
The Wilcoxon rank sum test is not a test of medians. You can see that if you look at its formula.
Statistically signifcant result of that test will only be caused by different medians (in the
population) if certain distributional requirements are fulfilled (in the population), which is
rarely the case (I suppose), and difficult to verify.

There is a test called median test which is designed for that purpose.

By the way
So, what non-parametric test is used to compare the "means" of two independent groups?? I've been tough that Wilcoxon is used for means! Not for medians!
The Wilcoxon test is a test for ranks (ordinal scaled data), not for interval scaled data.
Ordinal scales do not have a mean.

With kind regards

Karabiner

##### New Member
The Wilcoxon rank sum test is not a test of medians. You can see that if you look at its formula.
Statistically signifcant result of that test will only be caused by different medians (in the
population) if certain distributional requirements are fulfilled (in the population), which is
rarely the case (I suppose), and difficult to verify.

There is a test called median test which is designed for that purpose.

By the way

The Wilcoxon test is a test for ranks (ordinal scaled data), not for interval scaled data.
Ordinal scales do not have a mean.

With kind regards

Karabiner

I've used mood.medtest function in the package of RVAideMemoire for comparing the medians of two independent groups in R. The data are interval. But I need a median test for one.sided hypothesis. Do you know any function to meet the test?

#### Karabiner

##### TS Contributor
More often than not, a one-sided hypothesis seems inappropriate.
Why do you think it is necessary here?

Apart from that, the relationship between one-tailed and two-tailed
test results is the same as in the t-test or correlation.

With kind regards

Karabiner

##### New Member
More often than not, a one-sided hypothesis seems inappropriate.
Why do you think it is necessary here?

Apart from that, the relationship between one-tailed and two-tailed
test results is the same as in the t-test or correlation.

With kind regards

Karabiner

In my research, one hypothesis is that the average (mean) length of stay (Loss) of one group in a hospital ward is shorter than that of another group. Also, I want to examine this hypothesis between the medians of the groups.

The distributions of groups' (LoS) aren't normal. So, I need two non-parametric tests for means and medians. And because of my hypotheses, I think one-tailed seems appropriate.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Use a two-sided test. If for some reason the LOSs are the opposite of what you expect and you committed to the one-sided - ideally you are not allow to change to a two-sided and you have to report that you are unable to report the difference between the groups due to your a priori commitment to the one-sided test. How big is your sample size? As I mentioned, quantile regression can be used and then you would be able to control for covariates if desired, such as patient age, comorbidities, and disease severity, etc.

#### Karabiner

##### TS Contributor
In my research, one hypothesis is that the average (mean) length of stay (Loss) of one group in a hospital ward is shorter than that of another group. Also, I want to examine this hypothesis between the medians of the groups.
The distributions of groups' (LoS) aren't normal. So, I need two non-parametric tests for means and medians.
There is no such thing as a non-parametric test for means, but the non-normal
distributions matter for the t-test (or better Welch test) only if your total sample
size is small. How large is it?

For the median, you could use the median test, as mentioned before, or maybe you
try a Kaplan-Meier survival analysis to compare time to discharge between groups.

With kind regards

Karabiner

##### New Member
107 and 62 are the groups' sizes.
Can I use t-test for comparing their means?

##### New Member
Isn't Mann-Whitney a non-parametric test test for comparing means??

#### Karabiner

##### TS Contributor
With such a large sample, you can use the t-test (or better the Welch test, because samp
le sizes are unequal and probably variances are inhomogenous), regardless of how the
variables are distributed in the respective groups.

Isn't Mann-Whitney a non-parametric test test for comparing means??
There is no "nonparametric test" which can compare means. The Mann-Whitney
(which is 100% equvalent to the Wilcoxon rank sum test) is is a test for ranked data
(ordinal scaled data). Such data do not have a mean.

With kind regards

Karabiner

Last edited:

##### New Member
With such a large sample, you can use the t-test (or better the Welch test, because samp
le sizes are unequal and probably variances are inhomogenous), regardless of how the
variables are distributed in the respective groups.

There is no "nonparametric test" which can compare means. The Mann-Whitney
(which is 100% equvalent to the Wilcoxon rank sum test) is is a test for ranked data
(ordinal scaled data). Such data do not have a mean.

With kind regards

Karabiner
You made a big help in my work. Thanks.