**[R] centile** -- Report centile and confidence interval

__Syntax__

**centile** [*varlist*] [*if*] [*in*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Main
__c__**entile(***numlist***)** report specified centiles; default is **centile(50)**

Options
__cc__**i** binomial exact; conservative confidence interval
__n__**ormal** normal, based on observed centiles
__m__**eansd** normal, based on mean and standard deviation
__l__**evel(***#***)** set confidence level; default is **level(95)**
-------------------------------------------------------------------------
**by** and **statsby** are allowed; see prefix.

__Menu__

**Statistics > Summaries, tables, and tests >** **Summary and descriptive**
**statistics > Centiles with CIs**

__Description__

**centile** estimates specified centiles and calculates confidence intervals.
If no *varlist* is specified, **centile** calculates centiles for all the
variables in the dataset. If no centiles are specified, medians are
reported.

By default, **centile** uses a binomial method for obtaining confidence
intervals that makes no assumptions about the underlying distribution of
the variable.

__Options__

+------+
----+ Main +-------------------------------------------------------------

**centile(***numlist***)** specifies the centiles to be reported. The default is
to display the 50th centile. Specifying **centile(5)** requests that the
fifth centile be reported. Specifying **centile(5 50 95)** requests that
the 5th, 50th, and 95th centiles be reported. Specifying
**centile(10(10)90)** requests that the 10th, 20th, ..., 90th centiles be
reported.

+---------+
----+ Options +----------------------------------------------------------

**cci** (conservative confidence interval) forces the confidence limits to
fall exactly on sample values. Confidence intervals displayed with
the **cci** option are slightly wider than those with the default (**nocci**)
option.

**normal** causes the confidence interval to be calculated by using a formula
for the standard error of a normal-distribution quantile given by
Kendall and Stuart (1969, 237). The **normal** option is useful when you
want empirical centiles -- that is, centiles based on sample order
statistics rather than on the mean and standard deviation -- and are
willing to assume normality.

**meansd** causes the centile and confidence interval to be calculated based
on the sample mean and standard deviation, and it assumes normality.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

__Examples__

Setup
**. sysuse auto**

Calculate the 50th centile for all variables in the dataset
**. centile**

Calculate the 50th centile for **price**
**. centile price**

Calculate the 50th centile for **price**, showing 99% CI
**. centile price, level(99)**

Calculate the 5th, 50th, and 95th centiles for **price**
**. centile price, centile(5 50 95)**

Calculate the 10th, 20, 30th, ..., 90th centiles for **price**
**. centile price, centile(10(10)90)**

Calculate the 10th centile for **price**, assuming normality
**. centile price, centile(10) normal**

__Stored results__

**centile** stores the following in **r()**:

Scalars
**r(N)** number of observations
**r(n_cent)** number of centiles requested
**r(c_***#***)** value of *#* centile
**r(lb_***#***)** *#*-requested centile lower confidence bound
**r(ub_***#***)** *#*-requested centile upper confidence bound

Macros
**r(centiles)** centiles requested

__Reference__

Kendall, M. G., and A. Stuart. 1969. *The Advanced Theory of Statistics,*
*Vol. 1: Distribution Theory*. 3rd ed. London: Griffin.