BookmarkSubscribeRSS Feed
littlezeno
Calcite | Level 5

Hi,

 

I'm using Proc Freq to do Friedman test. As a new requirement, I need to produce Kendall W statistics for correlation analysis (effect assessment). However, there is no easy way in SAS to produce this statistics. Please advice how to get Kendall W in SAS. 

I wonder if SAS can have some way to make Friedman related test a little easier. 

10 REPLIES 10
Reeza
Super User

FYI - In the forum selection one of the last few is SASware Ballot Ideas. You can submit ideas for SAS to consider for development.

Rick_SAS
SAS Super FREQ

Can you provide a formula or reference to a paper that describes the statisic and its distribution?

littlezeno
Calcite | Level 5

Yes. 

This is Wikipedia reference. https://en.wikipedia.org/wiki/Kendall%27s_W

 

Also http://core.ecu.edu/psyc/wuenschk/SAS/SAS-Programs.htm provided a sample code to work around. called 

Kendall-patches -- Kendall's Coefficient of Concordance.

 

Basically, it is trying to using an already ranked data in Proc Freq. 

So general association (I guess it is based on Pearson's correlation) output now is equivalent to  Kendall's W. 

 

By following the work around, I now first use the Proc rank, then apply Proc Freq to do the test.

 

Please let me know if this clarified. 

 

Kind Regards

Zeno

 

 

ballardw
Super User

Compare the results of your "Kendal patch" results with using your raw data requesting and a tables statement like:

tables var1 * var2 / cmh scores=rank;

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You can do it with data ranked by subject (e.g., block), and then using ANOVA.  This is a section of a macro I wrote for other purposes:

proc sort data=&data out=_a;
    by &blk;
proc rank data=_a out=_a;
    by &blk;
    var &response; ranks rx;


*---One can obtain relevant statistics for Kendall statistic using
    either proc anova (with the right form or ranks) or proc freq;

proc anova data=_a;
    title2 'Friedman from PROC ANOVA; W = SSTrt/(SSTrt+SSError); Q = W*(#blks*(#trts-1))';
    class &blk &trt;
    model rx = &blk &trt;
    means &trt;

With more work, one can use an ods output statement to save the SS statistics, etc., and then calculate W and Q in a data step.  (I realize that I am using a legacy PROC [ANOVA], but Friedman requires balanced data with no missing values, so ANOVA is fine).

 

littlezeno
Calcite | Level 5

But ANOVA assums Normal distribution. Non-parametric compares kai square (x^2) distribution. 

I'm not sure if the significance report would be realiable if the compared distribution is not "approperiate". 

Do you have some references suggest doing this way is valid or provide equivalent results to Friedman?

Thank you

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

This is absolutely valid, and has been known for decades. One does NOT use the tests of significance from ANOVA. One is using the sum of squares only. One is using ANOVA as an engine to crank through the calculations. If you look at the title statements in my code, it shows how one determines the chi-squared statistic and W based on the sum of squares from ANOVA on ranks-by-block. Basically, this is a trick to get the results.

littlezeno
Calcite | Level 5

 

Thank you. Do you happen to know the trick for the Friedman post-hoc analysis?

littlezeno
Calcite | Level 5

Yes.

 https://en.wikipedia.org/wiki/Kendall%27s_W 

Attachement shows Kendall's W original citation. 

 

SPSS provide Friedman test related statisitcs including Kendal's W as an alternative effect size estimation And Post-hoc statisitcs for Friedman (http://oak.ucc.nau.edu/rh232/courses/EPS625/Handouts/Nonparametric/The%20Friedman%20Test.pdf ). Non-parametric data is very common for my research. I have used R before. But I have to modify the code to count for repeated measures. 

 

littlezeno
Calcite | Level 5

Yes.

 https://en.wikipedia.org/wiki/Kendall%27s_W 

Attachement shows Kendall's W original citation. 

 

SPSS provide Friedman test related statisitcs including Kendal's W as an alternative effect size estimation And Post-hoc statisitcs for Friedman (http://oak.ucc.nau.edu/rh232/courses/EPS625/Handouts/Nonparametric/The%20Friedman%20Test.pdf ). Non-parametric data is very common for my research. I have used R before. But I have to modify the code to count for repeated measures. 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 10 replies
  • 4940 views
  • 4 likes
  • 5 in conversation