Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Median difference using MannU and quantile regression

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 12-10-2022 02:41 PM
(797 views)

Hi, I am looking to determine whether two medians are not equal and attempt to estimate the median difference between the two. From my research, I have found this can be done by performing the Wilcoxon Mann u test and quantile regression. However, I am confused on interrupting the for results each. Below if my data, code for both, results, and interpretation.

I think I am in the right direction but: Having trouble with the median difference estimate interpretation as well as understanding why the discrepancy in significance results.

Happy to clarify anything that may have been unclear and appreciate the support.

Mann U (npar1way) median a median b median diff pval (kruskalW) hodgeL

Interpretation 601 642 41 0.01 issue getting to load

Median A and Median B are considered to be significantly different (difference=41, p<.05) as determined by the mannU test

Quantile regression median a median b median diff pval

Interpretation 601 642 34 (-74 - 143.78) 0.524

Median A and Median B are not considered to be significantly different (difference= 34.5 (-74.7 - 143.78), p=.52) as determined by quantile regression

```
*Determine medians of the two groups;
proc means data=test_data median;
var y;
class x;
run;
*Perform W-Mann-U test using KW for results;
*HL for median difference not loading, useful?;
proc npar1way data=test wilcoxon median;
class x;
var y;
exact hl / maxtime=60;
run;
*Quantile regression to determine median difference estimate and signifiance difference;
proc quantreg data=test_data;
class x;
model y= x/ quantile=.5;
estimate x 1 -1 /CL;
run;
```

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The null hypothesis of Kruskal-Wallis test and Wilcoxon rank sum test is the mean ranks of two groups are the same, not the medians of two groups are equal. When the distributions of two samples are different, even they have equal median or mean, the two tests can still reject the null hypothesis, and conclude the two distributions are significantly different. So if you want to compare medians, the quantile regression or the CI of medians can be used as the link described given by @Rick_SAS.

Sorry I don't know much about Hodges-Lehmann CI of median, so cannot answer why the results from EXACT HL is different from the results of PROC QUANTREG.

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The null hypothesis of Kruskal-Wallis test and Wilcoxon rank sum test is the mean ranks of two groups are the same, not the medians of two groups are equal. When the distributions of two samples are different, even they have equal median or mean, the two tests can still reject the null hypothesis, and conclude the two distributions are significantly different. So if you want to compare medians, the quantile regression or the CI of medians can be used as the link described given by @Rick_SAS.

Sorry I don't know much about Hodges-Lehmann CI of median, so cannot answer why the results from EXACT HL is different from the results of PROC QUANTREG.

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.