To perform a test of significance between means of two groups is well known. But if I use the medians is it possible to test for significance between medians of two groups?
Why don't you take a look at the "Kruskal–Wallis test", as a nonparametric method to test whether there is a significant difference between medians of two (or more) groups or not. Equivalently, you can use Mann–Whitney U test.
This method is equivalent to ANOVA, while the latter assumes a normal distribution of residuals.
Hello Dr Khan, can I ask why are you using median ? is the data skewed ? in which case why not log transform the data. Maybe there is another reason. Regards, Deborah http://sites.google.com/site/deborahhilton/
Yes, Bootstrapping method is an ideal way to do this. Basically for each median, you can re-sample your sample with replacement for a large number of times (e.g. 1000 times with a sample n=100). In doing so, you will get a normal distribution of the median you have and have a standard error. Thus, you will be able to get 95% CI. Finally, you can check if the two 95% CIs overlap. If they do, it implies the two median are not statistically significant.
I used this method in one of my publications (can be downloaded from my publication list at Researchgate).
Wang P, Yi Q, Scully L, Heathcote J, Krahn M: Indications for interferon/ribavirin therapy in hepatitis C patients: findings from a survey of Canadian hepatologists. Can J Gastroenterol 2003, 17(3):183-186.
I too recommend bootstrapping, but I would go one step further using the bootstrap to estimate a single confidence interval on the difference in medians. If the confidence interval contains zero, then there is no significant difference in medians. This makes more direct inference to the question of interest. For some quick examples, google [confidence interval on the difference in medians]. I would start with the percentile bootstrap method for confidence intervals. For greater detail, see the Efron and Tibshirani book "An introduction to the bootstrap" Section 8.3 "The two-sample problem".
Dear all, In fact, we are conducting a study on stroke in Qatar, in this study we want to compare between Arabs and south Asians to find whether there are significant statistical differences between theses two ethnicities in the age, risk factors, presentation and outcome. In the age, because of skewed distribution we used the median.
I'm thinking you need to do more than just naive comparison of medians. I would suggest that you will need to adjust for age, gender and other demographic variables. This will lead to some form of generalized linear model. Assuming you are looking at counts this will lead to a Poisson regression. Se the link or a start on fitting generalized linear models in R
Hello Dr Khan, there is also a chapter on GLM in the electronic statistical textbook link on the favourite links page of my website.
Deborah Hilton Statistics Online
http://sites.google.com/site/deborahhilton/
you say above in the age, because of skewed distribution we used the median, can you not log transform the age dependent variable - am I correct in understanding what you are saying ?? then it should be normally distributed and you would do a t test to compare the two nationalities. One of my friends close by has just had a stroke aged 46 and he is shocked as he thought he was way too young, but you never know what is around the corner. Maybe I've Interpreted what you are saying incorrectly with age, am I right?. Gee, I'm 46, I'd better go and do my exercise and reduce my risk !!!! too much sedentary time on the computer/ screen time must surely be a risk factor that researchers can be guilty of, maybe not maybe smoking, weight more so.
Dear Debora, I think you have incorrectly interpreted my question. I mentioned the age as an example, but my question is about any medians. Is it possible to test for significance between medians of two groups?
Stata has a nice procedure for quantile regression, that can be used for medians and allows for inclusion of covariates in the models, including a simple contrast between two groups. The name of the procedure is "qreg". Good luck!
When you compare medians, you should stop and ask yourself if you are interested in the difference in the medians of the two groups, or in the median difference between the observations in the two groups. The median difference is an interesting measure of effect size. It's harder to interpret the difference in medians, since we tend to extrapolate group differences to individuals, and in the case of medians, this doesn't hold.
This was I did in one of my papers (PMID 12677268): Can J Gastroenterol. 2003 Mar;17(3):183-6.
"The 95% CI for means were calculated using the conventional normal distribution method. Because there is no available statistical formula to directly calculate the 95% CI for medians, a bootstrap approach was employed (7,8). This technique involved dividing the total participants into subgroups (replicates), from which a random sample is taken with replacement and a new median was calculated each time. After a large number of such experiments, the lower and upper 95% CI were determined from the values at 2.5% and 97.5% percentiles. All the calculations were performed using SAS 8.0 (SAS, USA)"
Why don't you take a look at the "Kruskal–Wallis test", as a nonparametric method to test whether there is a significant difference between medians of two (or more) groups or not. Equivalently, you can use Mann–Whitney U test.
This method is equivalent to ANOVA, while the latter assumes a normal distribution of residuals.
I have a question about median tests, which I used for three groups (the homogenity of variance was violated and that is why I didn't use Kruskall Wallis test). The value ofmedian test shows significance ( χ2=5,778 in p = 0,016) with significant difference between group 1 and 2 ( φ=0,333, p=0,018 ). But when I look at medians of all three groups, each of them is 1,00. How can I interpret that?
Some non-parametric tests are available to test the significance of the difference between the medians of two independent random samples. Some of them are run test, sign test, rank-sum test etc. Thus the significance of the difference between medians of two groups can be tested by these non-parametric tests provided the two groups are independent and random.
The run test, sign test, rank-sum test etc. do not test the equality (in the sense of mathematical equality) of two medians but tests whether the difference between the two sample medians is significant or not i.e. whether the difference between the two sample medians can be counted or can be neglected i.e. whether the two sample medians can be regarded as statistically equal (but not mathematically equal) or statistically different.
Kruskall-Wallis is the equivalent of the anova. procidentally, if you reject the null hypothesis that the data come from similar or very similar populations around the median, you must perform an equivalent to the POSTHOC, to see where the rejection of similarity occurs. You can probably use WALD-WOLFOVITZ, MANN-WHITNEY, or MOSES TEST
Man-Whitney(-Wilcoxon) and Kruskal-Wallis do not test for equality of medians in general. Please refer to the null hypothesis. In very specific cases, involving equal scale parameters and symmetry of distributions (so, when the parametric test would work well, instead) it may (and happens to) work this way. It's fairly easy to show examples (please look at the attached simulation I made some time ago). Mood's test may be used for that purpose. Resampling methods (permutation test under the null hypothesis, bootstrapped confidence interval for difference in means) work well too, only remember to use the BCa approach when bootstrapping. Further reading: Article The Wilcoxon–Mann–Whitney Procedure Fails as a Test of Medians
Dear Professor Dhritikesh Chakrabarty. As I wrote in my post before yours, the null hypothesis of the Mann-Whitney -Wilcoxon rank-sum test (and also the Kruskal-Wallis) is not about medians. The rank sum test (and so does the Kruskal-Wallis) fails a as test of medians in general (mentioned in the article attached in my previous answer). It's a well known fact and it's easy to show that via simulations, as I did (examples attached to my previous post). This test can be totally fooled by differences in scale parameter and symmetry. If this happens, one cannot say, by no means, that rejected H0 is rejected due to differences in medians (otherwise one is likely to get wrong conclusions and do harm to the science).
The Wald–Wolfowitz run test also does not verify the hypothesis, that the samples come from populations with the same median. What it does may give consistent outcome with testing medians, but it is absolutely not guaranteed.
Using a test verifying a different null hypothesis that the one to be verified, is formally wrong and misleading (we test for X, using a test verifying Y; only rarely X will be "comparable" with Y).
Valid tests of medians are: Mood's test and permutation test of differences in medians. But the permutation method is correct if and only if the scale parameters are equal, so the principle of data exchangeability is held. Otherwise, observations cannot be swapped between the groups and the test doesn't make any sense.
Of course, if one doesn't need a p-value, and is fine with a confidence interval (which includes the statistical significance in it), bootstrapped CI of differences in medians can be calculated. It is advised to use the BCa (bias corrected and accelerated) one.