Programming the statistical procedures from SAS

Can SAS produce Kendall W statistics?

Reply
Occasional Contributor
Posts: 6

Can SAS produce Kendall W statistics?

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. 

Grand Advisor
Posts: 16,866

Re: Can SAS produce Kendall W statistics?

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

SAS Super FREQ
Posts: 3,306

Re: Can SAS produce Kendall W statistics?

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

Occasional Contributor
Posts: 6

Re: Can SAS produce Kendall W statistics?

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

 

 

Grand Advisor
Posts: 10,034

Re: Can SAS produce Kendall W statistics?

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;

Valued Guide
Valued Guide
Posts: 673

Re: Can SAS produce Kendall W statistics?

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).

 

Occasional Contributor
Posts: 6

Re: Can SAS produce Kendall W statistics?

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

Valued Guide
Valued Guide
Posts: 673

Re: Can SAS produce Kendall W statistics?

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.

Occasional Contributor
Posts: 6

Re: Can SAS produce Kendall W statistics?

 

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

Occasional Contributor
Posts: 6

Re: Can SAS produce Kendall W statistics?

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. 

 

Occasional Contributor
Posts: 6

Re: Can SAS produce Kendall W statistics?

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. 

 

Ask a Question
Discussion stats
  • 10 replies
  • 643 views
  • 4 likes
  • 5 in conversation