S2 2.2, S2 2.3, S2 2.5 - Cumulative functions and quantiles

S2 2.2, S2 2.3, S2 2.5 - Cumulative functions and quantiles

A cumulative distribution function collects probability from left to right. Build one from a density, recover the density by differentiation, and use the two functions to locate medians, quartiles and modes.

Constructing a piecewise cumulative function

If a density rises steadily across an interval, does its midpoint divide probability in half? Not usually: the greater heights on the right give more probability to that side. Accumulated area tells you where half the probability really lies.

Cumulative distribution function

The cumulative distribution function, or c.d.f., is

F(x)=P(X≤x)=∫−∞xf(t) dt.F(x)=\mathrm{P}(X\le x)=\int_{-\infty}^{x}f(t)\,\mathrm{d}t.

The integration variable tt distinguishes the variable being integrated from the upper limit xx. The integral definition of the c.d.f. is in the formula booklet.

A c.d.f. is nondecreasing, lies between zero and one, and is continuous for a variable with a density. Below the support it is zero. Above the support it is one, even though the density there is zero. At a change of formula, carry forward the probability already accumulated.

Worked example 1: one density formula

The density is f(x)=x/2f(x)=x/2 for 0≤x≤20\le x\le2, zero otherwise. Find F(x)F(x) for all real xx.

Plan. Separate values below, within and above the support.

For 0≤x≤20\le x\le2,

F(x)=∫0xt2 dt=[t24]0x=x24.F(x)=\int_0^x\frac t2\,\mathrm{d}t =\left[\frac{t^2}{4}\right]_0^x=\frac{x^2}{4}.

Answer.

F(x)={0,x<0,x2/4,0≤x≤2,1,x>2.F(x)=\begin{cases} 0,&x<0,\\ x^2/4,&0\le x\le2,\\ 1,&x>2. \end{cases}

Check. The middle formula gives F(0)=0F(0)=0, F(2)=1F(2)=1, and increases on the support. At its midpoint, F(1)=1/4F(1)=1/4, so the midpoint does not divide probability in half.

Change the density from a single formula to two pieces. The new decision is how to preserve the area collected before the join.

Worked example 2: carrying area across a join

Find the c.d.f. for

f(x)={x,0≤x≤1,1/2,1<x≤2,0,otherwise.f(x)=\begin{cases} x,&0\le x\le1,\\ 1/2,&1<x\le2,\\ 0,&\text{otherwise}. \end{cases}

Plan. Integrate each branch, including the first branch's area when x>1x>1.

For 0≤x≤10\le x\le1, F(x)=∫0xt dt=x2/2F(x)=\int_0^x t\,\mathrm{d}t=x^2/2. For 1<x≤21<x\le2,

F(x)=∫01t dt⏟1/2+∫1x12 dt=12+x−12=x2.F(x)=\underbrace{\int_0^1t\,\mathrm{d}t}_{1/2} +\int_1^x\frac12\,\mathrm{d}t =\frac12+\frac{x-1}{2}=\frac x2.

Answer.

F(x)={0,x<0,x2/2,0≤x≤1,x/2,1<x≤2,1,x>2.F(x)=\begin{cases} 0,&x<0,\\ x^2/2,&0\le x\le1,\\ x/2,&1<x\le2,\\ 1,&x>2. \end{cases}

Check. Both middle formulae give 1/21/2 at the join, and the upper branch gives F(2)=1F(2)=1. Although the density jumps from one to one half, its accumulated area does not jump.

Once FF is known, interval probabilities are P(a<X≤b)=F(b)−F(a)\mathrm{P}(a<X\le b)=F(b)-F(a), and upper-tail probabilities are 1−F(a)1-F(a).

Watch out

For x>1x>1 in the second example, (x−1)/2(x-1)/2 alone forgets the probability 1/21/2 already accumulated. A c.d.f. cannot restart at zero at an interior join.

Carry forward the first piece's area in this new distribution.

Differentiating a cumulative function

The slope of accumulated probability is density: differentiation reverses the integration that constructed FF.

Density from the c.d.f.

Where the derivative exists,

f(x)=F′(x).f(x)=F'(x).

This relation is expected recall in S2. Differentiate each branch on its own interval, and give density zero outside the support.

At a join, a c.d.f. may have a corner. A density's value at a single endpoint can be assigned either adjoining finite value without changing probabilities; there is no need to invent a derivative where none exists. A jump in FF would mean a positive point probability and would not describe the continuous density model studied here.

[DIAGRAM: asset_name: A density and its accumulated area; asset_slug: s2-density-cdf-link; caption: The density's area up to x becomes the c.d.f.'s height at x.; description: Side-by-side graphs of f(x)=x/2 on [0,2] and F(x)=x squared divided by 4 on [0,2], extended by constant zero and one outside the support. The left graph shades the area through x=1 as one quarter. The right graph labels F(1)=one quarter and F(square root of 2)=one half.]
The density's area up to x becomes the c.d.f.'s height at x.

Worked example 3: differentiating a power

For F(x)=x3/8F(x)=x^3/8 on 0≤x≤20\le x\le2, with F(x)=0F(x)=0 below zero and F(x)=1F(x)=1 above two, find the density.

Plan. Differentiate the polynomial branch and the constant branches separately.

ddx(x38)=3x28.\frac{\mathrm{d}}{\mathrm{d}x}\left(\frac{x^3}{8}\right)=\frac{3x^2}{8}.

Answer. f(x)=3x2/8f(x)=3x^2/8 on [0,2][0,2], zero otherwise.

Check. It is nonnegative, and ∫02(3x2/8) dx=[x3/8]02=1\int_0^2(3x^2/8)\,\mathrm{d}x=[x^3/8]_0^2=1.

Reflect the density across the midpoint of the support. The c.d.f. still increases, even though the density will now decrease.

Worked example 4: differentiating a reflected shape

For F(x)=1−(2−x)3/8F(x)=1-(2-x)^3/8 on [0,2][0,2], with the same outside branches, find the density.

Plan. Expand the cubic before applying polynomial differentiation.

F(x)=32x−34x2+18x3,F(x)=\frac32x-\frac34x^2+\frac18x^3, F′(x)=32−32x+38x2=38(2−x)2.F'(x)=\frac32-\frac32x+\frac38x^2=\frac38(2-x)^2.

Answer. f(x)=3(2−x)2/8f(x)=3(2-x)^2/8 on [0,2][0,2], zero otherwise.

Check. The density is nonnegative, and its integral from zero to xx is 1−(2−x)3/81-(2-x)^3/8. Its total area is therefore one.

A cumulative function's height and slope convey different information.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account