# Tukey: The Studentized Range Distribution

## Description

Functions of the distribution of the studentized range, R/s, where R is the range of a standard normal sample and df*s^2 is independently distributed as chi-squared with df degrees of freedom, see `pchisq`.

## Usage

 ```1 2``` ```ptukey(q, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE) qtukey(p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE) ```

## Arguments

 `q` vector of quantiles. `p` vector of probabilities. `nmeans` sample size for range (same for each group). `df` degrees of freedom for s (see below). `nranges` number of groups whose maximum range is considered. `log.p` logical; if TRUE, probabilities p are given as log(p). `lower.tail` logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].

## Details

If ng =`nranges` is greater than one, R is the maximum of ng groups of `nmeans` observations each.

## Value

`ptukey` gives the distribution function and `qtukey` its inverse, the quantile function.

The length of the result is the maximum of the lengths of the numerical arguments. The other numerical arguments are recycled to that length. Only the first elements of the logical arguments are used.

## Note

A Legendre 16-point formula is used for the integral of `ptukey`. The computations are relatively expensive, especially for `qtukey` which uses a simple secant method for finding the inverse of `ptukey`. `qtukey` will be accurate to the 4th decimal place.

## Source

`qtukey` is in part adapted from Odeh and Evans (1974).

## References

Copenhaver, Margaret Diponzio and Holland, Burt S. (1988). Computation of the distribution of the maximum studentized range statistic with application to multiple significance testing of simple effects. Journal of Statistical Computation and Simulation, 30, 1–15. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("10.1080/00949658808811082")}.

Odeh, R. E. and Evans, J. O. (1974). Algorithm AS 70: Percentage Points of the Normal Distribution. Applied Statistics, 23, 96–97. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("10.2307/2347061")}.

Distributions for standard distributions, including `pnorm` and `qnorm` for the corresponding functions for the normal distribution.
 ```1 2 3 4 5 6``` ```if(interactive()) curve(ptukey(x, nm = 6, df = 5), from = -1, to = 8, n = 101) (ptt <- ptukey(0:10, 2, df = 5)) (qtt <- qtukey(.95, 2, df = 2:11)) ## The precision may be not much more than about 8 digits: summary(abs(.95 - ptukey(qtt, 2, df = 2:11))) ```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7708597,"math_prob":0.98399293,"size":2082,"snap":"2021-21-2021-25","text_gpt3_token_len":550,"char_repetition_ratio":0.1174206,"word_repetition_ratio":0.006289308,"special_character_ratio":0.25552353,"punctuation_ratio":0.16957606,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9987546,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-18T04:36:09Z\",\"WARC-Record-ID\":\"<urn:uuid:034947f7-e8ea-43d4-bf9d-39a7d082e184>\",\"Content-Length\":\"76464\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c5b4160f-2d0e-470e-8472-7362a1900268>\",\"WARC-Concurrent-To\":\"<urn:uuid:73f209e1-d3fc-445e-80f2-0b978ab64f89>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/r/stats/Tukey.html\",\"WARC-Payload-Digest\":\"sha1:DCGLO5QZZUQ4CWBHMR57AHONCTLVEL3F\",\"WARC-Block-Digest\":\"sha1:LPCG4MGIFDCX2CZMDMPEKCNIOGZBIWP6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243989820.78_warc_CC-MAIN-20210518033148-20210518063148-00453.warc.gz\"}"}