What is the formula for calculating p-value of Tukey HSD http://onlinestatbook.com/calculators/tukeycdf.html

  • 1
    $\begingroup$ See wikipedia page. If you are interested in code see R functions ptukey and qtukey. -1 for not looking it up. $\endgroup$ – mpiktas Mar 6 '12 at 4:02
  • $\begingroup$ i was looking it up for how many hours and no luck, that's why i asked here. $\endgroup$ – JR Galia Mar 6 '12 at 15:10
  • 1
    $\begingroup$ Always check wikipedia first. If you enter Tukey HSD it immediately directs to the page about Tukey HSD where is a section how to calculate p-value. This is how I found it, I had no previous knowledge about this statistic. $\endgroup$ – mpiktas Mar 6 '12 at 16:39
  • $\begingroup$ mpiktas, can you specify the relevant formula from the mentioned Wikipedia article? I could not find it within this article. $\endgroup$ – Sympa Jun 25 '13 at 16:39

The following site contains the Matlab code for calculating the p-value for the Tukey HSD (based upon an unidentified FORTRAN program): http://www.mathworks.com/matlabcentral/fileexchange/37450-cumulative-distribution-function-of-the-studentized-range--for-tukey-s-hsd-test-

The calculation relies upon the observed value of Tukey's test, degrees of freedom (total number of elements minus number of groups, and the number of samples.

The following site, asking about a implementation provides the basics of a formula which can be used with any application which calculates the Studentized Range Distribution: http://www.stata.com/statalist/archive/2012-02/msg00469.html From the website:

p = 1 - tukeyprob(k, df, q)

where p is the p-value, tukeyprob is equivalent to ptukey in R, k is the number of means to compare, df are the degrees of freedom, and q is the HSD test statistic.

In , the equation would be p = 1 - ptukey(q, k, df).


Based upon a comment, the equation these algorithms are attempting to solve is:

$$f\left ( q;k,v \right )=\frac{\sqrt{2\pi}k\left ( k-1 \right )v^{v/2}}{\Gamma\left ( \frac{v}{2} \right )2^{v/2-1}}\int_{0}^{\infty }x^v\varphi \left ( \sqrt{v}x \right )\left [ \int_{-\infty}^{\infty}\varphi\left ( u \right )\varphi\left ( u-qx \right ) \left ( \Phi\left ( u \right )- \Phi\left (u-qx \right ) \right )^{k-2}du\right ]dx$$

| cite | improve this answer | |
  • $\begingroup$ These are useful references--but that's all they are. They can hardly be construed as formulas. The Fortran code (which actually is AS 190) is computing an integral: the formula would be the integral rather than this code. Unfortunately, the code says little about what integral it's computing. I believe Tukey's HSD is based on a Studentized range, so likely the relevant distribution is that described at en.wikipedia.org/wiki/Studentized_range_distribution. $\endgroup$ – whuber Apr 7 '17 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.