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;
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.
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."
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.