I have rewritten the 'tolerance' command which is now described correctly*. I've used percentofpop(#) and the option confidence(#). I've also added more features, and explained the connection to prediction intervals, as well as exact confidence intervals for percentiles.

To get the new 'tolerance' command, type

. ssc install tolerance



*the original 'tolerance' command (Lachenbruch 2004) was described incorrectly; p(#) was described as the confidence level, and gamma(#) as the coverage proportion, whereas the opposite was true: gamma(#) was the confidence level, and p(#) the coverage proportion.


tolerance, and the immediate command tolerancei, calculate one-sided or two-sided tolerance intervals, assuming a sample has been drawn randomly from a normal distribution. The factor, k, used in the calculation (mean ± k × sd, mean - k × sd, or mean + k × sd) is also reported.

Tolerance intervals are statistical intervals that contain (or cover) at least a percentage of a population, either on average, or else with a stated confidence. Prediction intervals, and confidence intervals on quantiles can be regarded as special cases of tolerance intervals (Vangel, 2005).

A 95% tolerance interval with #% confidence is an interval that contains at least 95% of a population, with #% confidence.

A 95%-expectation tolerance interval is an interval that contains at least 95% of a population, on average. It is equivalent to a 95% prediction interval. A prediction interval is an interval where a future measurement is expected to lie, with a given confidence level.

A one-sided p% tolerance interval with #% confidence is equivalent to a one-sided #% confidence interval for the pth percentile.

[Extra] A two-sided 95% confidence interval for the pth percentile can be formed by using the bounds of one-sided p% tolerance intervals with 97.5% confidence. It is an oversight of [R] centile that this exact method is not available.


Code:
Examples

        . sysuse auto, clear

 

  Computing a 95%-expectation tolerance interval (equivalently a 95% prediction interval)
        
    Either of these commands could be used:

        . tolerance mpg, percentofpop(95)

        . tolerancei 74 21.2973 5.785503, percentofpop(95)

95%-expectation tolerance interval, or equivalently, 95% prediction interval:
     9.689162  to  32.90544     (i.e.  mean  ±  2.006418 × sd) 



    Computing a 95% tolerance interval with a 99% confidence level

    Either of these commands could be used:

        . tolerance mpg, percentofpop(95) confidence(99)

        . tolerancei 74 21.2973 5.785503, percentofpop(95) confidence(99)

95% tolerance interval with 99% confidence:
     7.183769  to  35.41083     (i.e.  mean  ±  2.439465 × sd) 



    Getting the same factors as those reported in Howe (1969)

    Factors k=3.101 [and k=3.082] were reported in Table 1 for N=13 for the principal [and simpler] method,
    with percentofpop(95) confidence(95). Note the choice of mean and sd below does not affect the factor.

        . tolerancei 13 0.1234 0.6789, percentofpop(95) confidence(95)
95% tolerance interval with 95% confidence:
    -1.981733  to  2.228533     (i.e.  mean  ±  3.100799 × sd) 

        . tolerancei 13 0.1234 0.6789, percentofpop(95) confidence(95) m(howesimpler)
95% tolerance interval with 95% confidence [method(howesimpler)]:
     -1.96903  to   2.21583     (i.e.  mean  ±  3.082089 × sd)



    Computing a one-sided 90% tolerance interval with 95% confidence
        (equivalently a one-sided 95% CI for the 90th percentile)

    This reproduces the answer given in Example 4.4 (Section 4.4) in Meeker et al. (2017).

        . tolerancei 5 50.10 1.31, percentofpop(90) confidence(95) onesided
One-sided 90% tolerance intervals with 95% confidence are:
      50.7796 to +infinity  (lower bound = mean + .5187798 × sd)
    -infinity to  54.56269  (upper bound = mean + 3.406633 × sd)



    [Extra] Computing a two-sided 95% confidence interval for the 2.5th percentile

    tolerance can be used to produce an exact two-sided 95% confidence interval for the pth percentile, which
    [R] centile cannot yet do.

        . tolerance mpg, percentofpop(2.5) confidence(97.5) onesided
[Extra] Two-sided 95% CI for the 2.5th percentile: 
     7.326549 to  11.95024 

        . centile mpg, centile(2.5) level(95) meansd
                                   -- Normal, based on mean and std. dev.--
    Variable |       Obs  Percentile    Centile        [95% conf. interval]
-------------+-------------------------------------------------------------
         mpg |        74        2.5    9.957919        7.695014    12.22082

References

Howe, W. G. (1969) Two-sided tolerance limits for normal populations - some improvements. Journal of the
American Statistical Association, 64, 610–620.

Lachenbruch, P. (2004) "TOLERANCE: Stata module to generate tolerance intervals from input data,"
Statistical Software Components S447401, Boston College Department of Economics, revised 19 Jan 2006.

Meeker, W. Q., G. J. Hahn and L. A. Escobar. (2017) Statistical Intervals: A guide for practitioners and
researchers. Second edition. John Wiley & Sons, Inc.

Vangel, M. G. (2005) Tolerance Interval. In The Encyclopedia of Biostatistics, 2nd Edition, edited by P.
Armitage and T. Colton. John Wiley & Sons, Ltd.

Young, D. S. (2010) "tolerance: An R Package for Estimating Tolerance Intervals". Journal of Statistical
Software. 36 (5): 1–39. ISSN 1548-7660. Retrieved 19 February 2013. Documentation for Version 2.0.0
(2020-02-04) here: "https://ift.tt/3vN5VwU"