View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

1.5 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.77 KB File ID: #3469 Version: 1.0




20 May 2003 (Updated )

Finds the Tukey's q studentized range critical value.

| Watch this File

File Information

This function finds the Tukey's q studentized range critical value. This modified macro is based on the Fortran77 algorithm AS 190.2 Appl. Statist. (1983). It needs the sample degrees of freedom (must be the same for each sample), the k number of samples and the p-cumulative probability value (default=0.95). It gives a very good approximation for 0.8 < p < 0.995).


This file inspired Cumulative Distribution Function Of The Studentized Range (For Tukey's Hsd Test).

MATLAB release MATLAB 5.3 (R11)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
22 Feb 2013 Sav Deb

The last if condition, return values only for v<120. For v> it returns errors!!

Comment only
22 Feb 2013 Sav Deb

Is there a better mode to obtain the q-vaue?
Has someone already converted Fortran routines prtrng() and qrtrng to m files?

Other solution?


23 May 2012 Mark

Mark (view profile)

The statistics toolbox does have a private function that implements AS 190 and 190.2 under toolbox/stats/private/stdrinv.m from R2011a. It is called from the multcompare tool when doing the default Tukey HSD comparison.

The note accompanying the code is
% Based on Fortran program from statlib,
% Algorithm AS 190 Appl. Statist. (1983) Vol.32, No. 2
% Incorporates corrections from Appl. Statist. (1985) Vol.34 (1)

Comment only
17 Apr 2011 William Rose

William Rose (view profile)

qTukey() not very accurate.
qTukey implements an algorithm (AS 190.2, called qtrng0() in the Fortran) which was only intended to be a first approximation of Tukey's q. qtrng0 was intended to serve as a startup estimate for the more accurate routine, AS 190.1, called qtrng() in the Fortran. qtrng() uses AS 190, called prtrng() in the Fortran. ptrng() computes a p value for a given q statistic. qtrng() computes q for a desired probability p by recursively calling prtrng() and updating its estimate for q, until the desired accuracy is achieved (p within 0.001 in the Fortran code). If someone converts the Fortran routines prtrng() and qrtrng to m files, then we will have a good algorithm for estimating Tukey's q. Fortran code at

Comment only
03 Apr 2006 Liran Carmel

Not accurate. For example, qtukey(20,11,0.99) is 6.1422, while in the tables it is 6.190.

Contact us