BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Levi_M
Fluorite | Level 6

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
RosieSAS
Obsidian | Level 7

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. 

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

For experts who are wondering why PROC QUANTREG is being used, the OP appears to be using information and sample code from the blog post "Quantile estimates and the difference of medians in SAS."

RosieSAS
Obsidian | Level 7

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. 

sas-innovate-2024.png

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.

 

Register now!

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.

Discussion stats
  • 2 replies
  • 798 views
  • 2 likes
  • 3 in conversation