Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I have written C++ code to calculate the exact Jonckheere Terpstra distribution (and therefore p-value) by enumerating all the possible combinations. I've found that PROC FREQ in SAS has option JT and exact which calculate the same p-value.

As a relative newcomer to SAS, I was wondering if anyone could offer insight into how SAS typically calculates these exact distributions. The reason I am so interested is because SAS's code runs a few orders of magnitude faster than my C++ code, after I've made some attempts to optimize it.

share|improve this question
2  
SAS' code is proprietary, so I doubt you'll find it, but you may find some information in the "Details" section of the SAS documentation for a particular PROC; in the case of PROC FREQ and EXACT, I believe SAS uses an algorithm by Mehta and Patel. For the JT test, I think the reference is Mehta, C. R., Patel, N. R., and Tsiatis, A. A. (1984), "Exact Significance Testing to Establish Treatment Equivalence with Ordered Categorical Data," Biometrics, 40, 819–825. – Peter Flom Feb 29 '12 at 14:17
2  
@Peter That's worth converting this as an answer, if you have time and inclination. – chl Feb 29 '12 at 15:48
1  
@Peter, the relevant paper seems to actually be Mehta Patel (1983): A Network Algorithm for Performing Fisher's Exact Test in r x c Contingency Tables, but thanks for guiding me in the right direction! – Gschneider Feb 29 '12 at 17:45
1  
@Peter The comment-answer issue has been discussed on Meta. I can imagine that with minor edits (e.g., first reference) this would have been a response on its own. Regarding one of your recent answer (if you're talking about the thread dealing with effect size NHST), that's just because it is not recommended to post separate replies when they can be combined into one; and, it looks like it was the case. However, posting another reply, e.g. taking a different perspective so that both responses appear not related one to the other, is ok in general. – chl Mar 1 '12 at 8:06
1  
@Peter, you are correct. My mistake, I was looking ahead to the other tests I have to write. – Gschneider Mar 2 '12 at 5:30
show 4 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.