13 Percentiles: Cumulative Distribution Functions and Quantile Functions
- The probability density function of a continuous random variable describes which values are more or less likely in the “close to” sense.
- However, the pdf does not provide probabilities directly; rather, it is areas under the pdf which provide probabilities.
- There are many ways of describing distributions. In particular, a distribution is basically just a collection of percentiles.
- Cumulative distribution functions and quantile functions describe distributions by specifying all the percentiles.
- Roughly,
- The cumulative distribution function (cdf) of a random variable fills in the blank for any given \(x\): \(x\) is the (blank) percentile.
- The quantile function fills in the following blank for a given \(p\in(0, 1)\): the (\(100p\))th percentile is (blank).
Example 13.1 Explain what the percentiles mean in the following statements.
- 47cm is 12th percentile of heights for newborn girls.
- 620 is the 80th percentile of SAT Math scores.
- A distribution is characterized by its percentiles.
- Roughly, the value \(x\) is the \(p\)-th percentile (a.k.a. quantile) of a distribution of a random variable \(X\) if \(p\) percent of values of the variable are less than or equal to \(x\): \(\text{P}(X\le x) = p\).
- A few commonly used percentiles
- First (or lower) quartile is the 25th percentile (\(p=0.25\))
- Median is the 50th percentile (\(p=0.50\))
- Third (or upper) quartile is the 75th percentile (\(p=0.75\))
Example 13.2 Recall Example 12.1 and Example 12.2 where office arrival times, measured in minutes after 8am, followed this pdf \[ f_X(x) = \begin{cases} (2/3600)x, & 0<x<60,\\ 0 & \text{otherwise.} \end{cases} \]
- Compute \(\text{P}(X < 15)\) and phrase the result in terms of a percentile.
- Compute \(\text{P}(X < 45)\) and phrase the result in terms of a percentile.
- Find an expression for \(\text{P}(X \le x)\) for general \(x\). This function, denoted \(F_X(x)\), is called the cumulative distribution function (cdf) of \(X\).
- How does the cdf relate to percentiles?
- Use the cdf to determine what percentile 30 minutes after 8am is.
- Compute and interpret \(F(40) - F(30)\).
- The cumulative distribution function (cdf) of a random variable fills in the blank for any given \(x\): \(x\) is the (blank) percentile. That is, for an input \(x\), the cdf outputs \(\text{P}(X\le x)\).
- The cumulative distribution function (cdf) of a random variable \(X\) is the function \(F_X\) defined by \(F_X(x) = \text{P}(X\le x)\). A cdf is defined for all real numbers \(x\) regardless of whether \(x\) is a possible value of \(X\).
Example 13.3 Continuing Example 13.2 where \(X\) (minutes after 8am) has pdf \[ f_X(x) = (2/3600)x, \qquad 0<x<60. \] and cdf \[ F_X(x) = \begin{cases} 0, & x<0,\\ (x/60)^2, & 0<x<60,\\ 1, & x>60. \end{cases} \]
- Find and interpret the 10th percentile.
- Find and interpret the 90th percentile.
- Find an equation for the (100\(p\))th percentile (e.g., \(p=0.9\) for the 90th percentile).
- The quantile function (essentially the inverse cdf) fills in the following blank for a given \(p\in(0, 1)\): the \(100p\)th percentile is (blank).
- For example, evaluating the quantile function at \(p=0.25\) outputs the 25th percentile.
- For a continuous random variable \(X\) with cdf \(F_X\), the quantile function \(Q_X\) is the inverse of the cdf, \(Q_X(p) = F_X^{-1}(p)\).
- A quantile function basically gives you the same information as a cdf, just in the other direction.
- Both a quantile function and a cdf define a distribution by specifying all the percentiles.
Example 13.4 Continuing Example 13.3 where \(X\) (minutes after 8am) has pdf \[ f_X(x) = (2/3600)x, \qquad 0<x<60. \] and cdf \[ F_X(x) = \begin{cases} 0, & x<0,\\ (x/60)^2, & 0<x<60,\\ 1, & x>60. \end{cases} \] and quantile function \[ Q(p) = 60\sqrt{p}, \qquad 0<p<1. \]
- Construct a circular spinner for simulating values of \(X\). Version 1: label the values 0, 10, 20, 30, 40, 50, 60. Careful: they will not be equally spaced.
- Sketch a histogram with equal bin widths—0 to 10, 10 to 20, etc.—that you would expect to see after spinning the version 1 spinner many times. Does it have the proper shape?
- Construct a circular spinner for simulating values of \(X\). Version 2: label the circular axis so that your spinner has 12 sectors each with probability 1/12.
- Sketch a histogram that you would expect to see after spinning the version 2 spinner many times. Start by sketching a histogram with unequal bin widths, then sketch the correspond equal bin width histogram. Does it have the proper shape?
- The cdf and the quantile function can be used to create a spinner for a distribution.
- A spinner basically describes a distribution by specifying all the percentiles. For example,
- the 25th percentile goes 25% of the way around (“3 o clock”)
- the 50th percentile goes 50% of the way around (“6 o clock”)
- the 75th percentile goes 75% of the way around (“9 o clock”)
- Intervals corresponding to regions of higher density (“more likely” values) are stretched out on the spinner boundary; intervals corresponding regions of lower density (“less likely” values) are shrunk.
- Universality of the Uniform (or “one spinner to rule them all”). Let \(F\) be a cdf and \(Q\) its corresponding quantile function. Let \(U\) have a Uniform(0, 1) distribution and define the random variable \(X=Q(U)\). Then the cdf of \(X\) is \(F\).
- Universality of the uniform might look complicated but all it basically says is that you can construct a spinner by putting the 25th percentile 25% of the way around, the 75th percentile 75% of the way around, etc.
- Actually, universality of the uniform says we don’t have to create a new spinner. We can just spin the Uniform(0, 1) spinner, with evenly spaced values from 0 to 1, and transform each resulting value by plugging it into the quantile function.
Example 13.5 Continuing Example 12.3. Suppose that \(X\) is a claim amount in excess of the decuctible for a car insurance policy that incurs a claim, measured in thousands of dollars. Assume that \(X\) has pdf \[ f_X(x) = (1/4.3) e^{-x/4.3}, \qquad x >0 \]
- Compute \(\text{P}(X < 5)\) and phrase the result in terms of a percentile.
- Find an expression for the CDF of \(X\).
- Compute the 25th percentile.
- Find an expression for the quantile function of \(X\).
- Use the quantile function to find the 75th percentile.
13.1 Exercises
Exercise 13.1 Continuing Exercise 12.1. In a certain population, household income \(X\) ($ thousands) follows the pdf \[ f_X(x) = c x^{-2.5}, \quad x \ge 30 \] for an appropriate constant \(c\). Note that the measurement units are $ thousands, so 1 represents 1 thousand dollars. (This is not a super realistic example, but just go with it.)
- Compute \(\text{P}(X\le 100)\) and phrase the result in terms of a percentile.
- Find the cdf of \(X\).
- Find the 10th percentile.
- Find the quantile function of \(X\).
- Sketch a circular spinner for simulating values of \(X\).
Exercise 13.2 Let \(X\) be the number of heads in 3 flips of a fair coin.
- Find the pmf of \(X\) and sketch a plot of it.
- Find the cdf of \(X\) and sketch a plot of it.
- Let \(Y\) be the number of tails in 3 flips of a fair coin. Find the cdf of \(Y\).
- A cdf is a non-decreasing function: if \(x_1 \le x_2\) then \(F_X(x_1)\le F_X(x_2)\).
- A cdf approaches 0 as the input approaches \(-\infty\): \(\lim_{x\to-\infty}F_X(x) = 0\)
- A cdf approaches 1 as the input approaches \(\infty\): \(\lim_{x\to\infty}F_X(x) = 1\)
- The cdf of a discrete random variable is a step function.
- The steps occur at the possible values of the random variable.
- The height of a particular step corresponds to the probability of that value, given by the pmf.
- The cdf of a continuous random variable is a continuous function.
- The cdf of a continuous random variable is obtained by integrating the pdf, so
- The pdf of a continuous random variable is obtained by differentiating the cdf \[ F_X' = f_X \qquad \text{if $X$ is continuous} \]
- For any random variable \(X\) with cdf \(F_X\) \[ F_X(b) - F_X(a) = \text{P}(a<X \le b) \] Whether the inequalities in the above event are strict (\(<\)) or not (\(\le\)) matters for discrete random variables, but not for continuous.
- Random variables \(X\) and \(Y\) have the same distribution if their cdfs are the same, that is, if \(F_X(u) = F_Y(u)\) for all \(u\).
- That is, two random variables have the same distribution if all the percentiles are the same.