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.
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).
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.
Bivariable Normal Distribution for TTEST, otherwise for Wilcoxon .
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).
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.