Programming the statistical procedures from SAS

Test the difference for median ?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Test the difference for median ?

Hi guys,

I have a very basic question, but could not find the convincing answer from Interest.

I have two groups with different number of observations.  I have already got the mean and median of the two group and the figure shows group A is larger than group B. But I do not know whether these are significant or not. So I want to do the univariate test to look at whether they have the same mean and same median. According to papers, the basic steps is to do t-test for mean and Wilcoxon test for median. But I have several questions regarding this:

1. Shall I use the one-sided t-test or two-sided t-test? What I did is using the coed below:

Proc ttest data=;

  class ;

  var ;

run;

Will this give me the one-sided t-test or two-sided t-test? And what is the common practice in the paper when they show whether the two group has different mean? one-sided or two-sided?

2. About the Wilcoxon test to test whether they have same median, shall I use Wilcoxon rank-sum test or Wilcoxon signed-rank test? I did see both but I do not know which to use.

And also when I read the result from SAS, shall I use the one-sided result or two-sided? I used the following code:

proc npar1way data = wilcoxon;

  class;

  var ;

run;

I really do not know which is the right way. I really appreciate your help. Cheers.


Accepted Solutions
Solution
‎02-06-2015 09:03 AM
Trusted Advisor
Posts: 2,114

Re: Test the difference for median ?

The Wilcoxon rank-sum test (also known as the Mann-Whitney test) is the test for basic comparison of two groups for difference in the median.  It assumes that the data are measured in the interval or ratio scale. 

The Wilcoxon signed-rank test is a one sample test that the median is a constant (typically 0, as it is often used for difference scores).

View solution in original post


All Replies
Super User
Posts: 18,529

Re: Test the difference for median ?

Re One sided/Two Sided P-Value

If your hypothesis is that

H0: X1=X2

H1: X1>X2 or (X1<X2)

then you use a one sided p-value.

If your hypothesis is:

H0: X1=X2

H1: X1 ne X2

then you use a two sided p-value.

I can't say which test you should use, but I highly recommend graphing your data, via box plot or violin plot to examine the distributions as well as testing.

Super User
Posts: 9,769

Re: Test the difference for median ?

Bivariable Normal Distribution for TTEST, otherwise for Wilcoxon .

Solution
‎02-06-2015 09:03 AM
Trusted Advisor
Posts: 2,114

Re: Test the difference for median ?

The Wilcoxon rank-sum test (also known as the Mann-Whitney test) is the test for basic comparison of two groups for difference in the median.  It assumes that the data are measured in the interval or ratio scale. 

The Wilcoxon signed-rank test is a one sample test that the median is a constant (typically 0, as it is often used for difference scores).

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 1014 views
  • 0 likes
  • 4 in conversation