BookmarkSubscribeRSS Feed
MaryA_Marion
Lapis Lazuli | Level 10

I am dong a wilcoxon signed rank test. I want to be sure I get the equations correct. Do ties have meaning here and can I list the number of them as can be done in proc npar1way? 

 

data two;
input X Y ;
D=X-Y;
cards;
1 4
3 7
2 6
3 8
5 6
;
title 'WILCOXON SIGNED RANK TEST' ;
PROC UNIVARIATE data=two;
VAR D;
RUN;

 

4 REPLIES 4
ballardw
Super User

@MaryA_Marion wrote:

I am dong a wilcoxon signed rank test. I want to be sure I get the equations correct. Do ties have meaning here and can I list the number of them as can be done in proc npar1way? 

 

data two;
input X Y ;
D=X-Y;
cards;
1 4
3 7
2 6
3 8
5 6
;
title 'WILCOXON SIGNED RANK TEST' ;
PROC UNIVARIATE data=two;
VAR D;
RUN;

 


Are you attempting to code the whole test from scratch?

First, not the difference but the absolute value of the difference.

     D= abs(x-y);

Second, discard all differences of zero (is this your "tie" question?)

Third, ties are assigned the average rank that the ties would have  (Proc Rank will do this for you)

 

 

 

 

MaryA_Marion
Lapis Lazuli | Level 10

I want to determine that the shapes of the two distributions (A and B) are similar. Note I have two dependent samples here which I am pairing. What is the best test to do that. I want to say more than mean median mode comparisons. How about comparing quantiles? 

If I take the pairwise differences and check for normality that doesn't quite do it. What if incoming shapes are uniform? Checking for normality would not be correct then.

An edf plot comparing differences to what ? Help! This is tricky.

ballardw
Super User

@MaryA_Marion wrote:

I want to determine that the shapes of the two distributions (A and B) are similar. Note I have two dependent samples here which I am pairing. What is the best test to do that. I want to say more than mean median mode comparisons. How about comparing quantiles? 

If I take the pairwise differences and check for normality that doesn't quite do it. What if incoming shapes are uniform? Checking for normality would not be correct then.

An edf plot comparing differences to what ? Help! This is tricky.


You haven't answered the question about are you trying to hand-code all this. If not, what is wrong with using Npar1way.

 

The first thing is to actually decide are you looking at distribution or some association between the two "dependent samples".

 

Distribution typically I would suggest starting with a graph of the two sets of values such as histograms.

 

If the Pairs of x,y values which I have to guess mean they are different results from the exact same inputs such as two different models then perhaps start with a scatter plot of the pairs at look for any obvious patterns. Similar distribution of x,y pairs would tend to show some shape such as possibly a relatively tight ellipse around a line or or other curve.

 

Depending on the number of records and range of values perhaps a Chi-square test as a test of similar distribution

MaryA_Marion
Lapis Lazuli | Level 10
I would want any coding I do by hand to include computation of exact p-values. Npar1wy definitely looks easier from that viewpoint.

As for Chi-square test my understanding is that it is for count data only. I have seen the following definition online: The Chi-square test of independence is a statistical hypothesis test used to determine whether two categorical or nominal variables are likely to be related or not.
On thinking about it more, I like the idea of comparing percentiles using confidence intervals for the percentiles from both samples.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 910 views
  • 1 like
  • 2 in conversation