q=srangeinv(p, v, ir) computes the deviate, x_p, associated with the lower tail probability of the distribution of the Studentized range statistic.

The externally Studentized range, q, for a sample,x_1,x_2 \cdots  x_r is defined as:

q=\frac{\max (x_i)-\min (x_i)}{ \hat{\sigma _e} }

Where \hat{\sigma _e} is an independent estimate of the standard error of the x_i 's.

For a Studentized range statistic the probability integral,P(q) , for \nu degrees of freedom and r groups, can be written as:  p(q)=C\int_0^\infty x^{\nu -1}e^{-\nu x^2/2}\{\Phi (y)[\Phi (y)-\Phi (y-qx)]^{r-1}dy\}dx

where p(q)C=\frac{\nu ^{\nu /2}}{\Gamma (\nu /2)2^{\nu /2-1}},\Phi (y)=\int_{-\infty }^y\frac 1{\sqrt{2\pi }}e^{-t^2/2}dt

For a given probability  p_0, the deviate q_0 is found as the solution to the equation



p (output, double)
the probability.
v (input,double)
the number of degrees of freedom for the experimental error \nu.  \nu ≥ 1.0
ir (input, int)
the number of groups,r .ir \geq 2
q (output, double)
the Studentized range statistic,q. q>0.0