4.1 - Cumulative distribution functions

4.1 - Cumulative distribution functions

A cumulative distribution function records the probability accumulated up to any chosen value. You will construct it from a piecewise density, recover a density by differentiation, and use cumulative probabilities to find intervals and percentiles.

From density to cumulative probability

If a density changes formula halfway across its support, how does the accumulated probability remember the area already collected? The next piece of the cumulative function must start from that earlier area.

For a uniform distribution on [0,2][0,2], the probability up to x=1/2x=1/2 is the rectangle's area (1/2)(1/2)=1/4(1/2)(1/2)=1/4. As xx moves right, this accumulated area increases from zero to one.

Cumulative distribution function

The cumulative distribution function, or CDF, of XX is

F(x)=P(X≤x).F(x)=\mathrm P(X\le x).

For a continuous distribution with PDF ff,

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

The letter tt is a variable of integration; xx is the moving upper limit. A CDF is nondecreasing, lies between zero and one, and tends to zero and one at the left and right extremes respectively. For the continuous distributions here, it is continuous even where the PDF jumps.

If the support is bounded, include F(x)=0F(x)=0 below it and F(x)=1F(x)=1 above it. Within each piece, integrate from its left endpoint and add the probability accumulated before that endpoint. This fixes the integration constant.

Worked example 1: carrying earlier area forward

Question. Find the CDF when

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

Plan. Integrate the first piece from zero; for the second, add the area up to one before integrating further.

For 0≤x≤10\le x\le1,

F(x)=∫0x13 dt=x3.F(x)=\int_0^x\frac13\,\mathrm dt=\frac{x}{3}.

For 1<x≤21<x\le2, the earlier area is F(1)=1/3F(1)=1/3, so

F(x)=13+∫1x23 dt=13+23(x−1)=2x−13.\begin{aligned} F(x)&=\frac13+\int_1^x\frac23\,\mathrm dt\\ &=\frac13+\frac23(x-1)=\frac{2x-1}{3}. \end{aligned}

Answer.

F(x)={0x<0x/30≤x≤1(2x−1)/31<x≤21x>2.F(x)= \begin{cases} 0&x<0\\ x/3&0\le x\le1\\ (2x-1)/3&1<x\le2\\ 1&x>2. \end{cases}

Check. At the join, both formulae give F(1)=1/3F(1)=1/3; at the endpoints they give F(0)=0F(0)=0 and F(2)=1F(2)=1. The slopes 1/31/3 and 2/32/3 also recover the two rectangle heights.

Now replace the constant pieces by a rising and a falling straight line. The integration constants still come from accumulated area, but the CDF pieces become quadratic.

Worked example 2: a triangular density

Question. Find the CDF when

f(x)={x0≤x≤12−x1<x≤20otherwise.f(x)= \begin{cases} x&0\le x\le1\\ 2-x&1<x\le2\\ 0&\text{otherwise}. \end{cases}

Plan. Find the first area, then add F(1)=1/2F(1)=1/2 when constructing the second piece.

F(x)=∫0xt dt=x22for 0≤x≤1F(x)=12+∫1x(2−t) dtfor 1<x≤2=12+[2t−t22]1x=2x−x22−1=1−(2−x)22.\begin{aligned} F(x)&=\int_0^x t\,\mathrm dt=\frac{x^2}{2} &&\text{for }0\le x\le1\\ F(x)&=\frac12+\int_1^x(2-t)\,\mathrm dt &&\text{for }1<x\le2\\ &=\frac12+\left[2t-\frac{t^2}{2}\right]_1^x\\ &=2x-\frac{x^2}{2}-1 =1-\frac{(2-x)^2}{2}. \end{aligned}

The last form expresses the same area as one minus the remaining right-hand triangle.

Answer.

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

Check. For x=3/2x=3/2, the uncollected triangle has base 1/21/2 and height 1/21/2, so F(3/2)=1−1/8=7/8F(3/2)=1-1/8=7/8. The second CDF formula gives the same result. Both pieces give 1/21/2 at x=1x=1.

The PDF height is the instantaneous rate at which cumulative probability increases. Where the PDF is high, the CDF is steep; after the support ends, it stays at one.

[DIAGRAM: asset_name: Density area becomes CDF height; asset_slug: cam9231-pdf-cdf; caption: The shaded area under the PDF up to x equals 1.4 is the CDF height 0.82; description: Two aligned panels show the exact triangular PDF f(x) equals x on zero to one and two minus x on one to two, and its CDF. The PDF is shaded up to x equals 1.4. The CDF is x squared over two to one and one minus (two minus x) squared over two from one to two, with horizontal extensions at zero and one. Guides and a marked point show F(1.4) equals 0.82; both panels identify the join x equals one.]
The shaded area under the PDF up to x equals 1.4 is the CDF height 0.82

Watch out

For the triangular example, 2x−x2/22x-x^2/2 is an antiderivative of the second density piece, but it is not the second CDF piece. The missing constant would give F(1)=3/2F(1)=3/2, an impossible probability. Include the earlier area and the lower-limit subtraction.

Use the accumulated-area method on a new density.

From CDF to PDF

Differentiating an accumulated area recovers its density, so a piecewise CDF gives a piecewise PDF.

On every open interval where the CDF is differentiable, f(x)=F′(x)f(x)=F'(x). Differentiate each expression only on its stated interval. A constant CDF gives zero density: no extra probability accumulates there. Below and above a bounded support, its constant values zero and one both differentiate to zero.

At a join the derivative may not exist. A PDF's value at one isolated point does not affect probabilities, so it can be assigned conveniently; the adjoining intervals still matter. For the piecewise differentiable continuous distributions here, check that the CDF joins continuously and that the recovered PDF has area one. A jump in a CDF would represent a positive point probability, rather than an ordinary continuous density alone.

Continue this lesson.

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

Create free account