I am new to Proc QuantReg. Comparing medians is appealing since it would be more robust to outliers than comparing means. The appeal of Quantreg, for me, is that it can compare medians while including other factors in the model. So you get what I'd call 'an adjusted test of medians' with QuantReg, instead of the usual unadjusted comparison of medians with Proc npar1way Wilcoxon. The first step is to get QuantReg to duplicate the Wilcoxon result. Then I’d use Proc Quantreg to improve on a Wilcoxon test by adjusting for other factors. I’ve come as close as I can using the test x / rankscore (wilcoxon); syntax below. Note that the Wald test p=.0899 given in the first Proc QuantReg below must not be right, since the 95%CI (-1.0039,-0.0535) for the X parameter estimate does not include 0. I don’t understand why we don’t see a SE and a p-value in the Parameter Estimates table output of Proc Quantreg. data one; call streaminit(736283); do i = 1 to 100; if i<51 then y=rand('NORMAL',0,1); if i<51 then x=0; if i>=51 then y=rand('NORMAL',.5,1); *<<<note .5 difference in means; if i>=51 then x=1; output; end; run; proc npar1way data=one WILCOXON; class x; var y ; run; Wilcoxon Two-Sample Test Statistic 2180.0000 Normal Approximation Z -2.3749 One-Sided Pr < Z 0.0088 Two-Sided Pr > |Z| 0.0176 proc quantreg data=one; class x; model y=x; test x; run; Parameter Estimates 95% Confidence Parameter DF Estimate Limits Intercept 1 0.4081 -0.0237 0.8264 x 0 1 -0.4365 -1.0039 -0.0535 x 1 0 0.0000 0.0000 0.0000 Test Results Test Chi- Test Statistic DF Square Pr > ChiSq Wald 2.8766 1 2.88 0.0899 The following syntax comes closer to the Wilcoxon p-value (Wilcoxon p=.0176; quantreq p=.0168), but why are they different?? proc quantreg data=one alpha=0.05 ; class x; model y=x; test x / rankscore (wilcoxon); run; Parameter Estimates 95% Confidence Parameter DF Estimate Limits Intercept 1 0.4081 -0.0237 0.8264 x 0 1 -0.4365 -1.0039 -0.0535 x 1 0 0.0000 0.0000 0.0000 Test Results Test Chi- Test Statistic DF Square Pr > ChiSq Rank_Wilcoxon 5.7132 1 5.71 0.0168
... View more