SR24–SR26 - Cumulative distribution functions

SR24–SR26 - Cumulative distribution functions

SR24 accumulates density into a cumulative distribution function and sketches its full shape. SR25 recovers density by differentiation. SR26 uses cumulative probabilities to find intervals, medians and percentiles, including selecting the correct branch of a piecewise function.

A cdf remembers all the probability to the left

A continuous variable has cdf F(x)=x2/4F(x)=x^2/4 for 0≤x≤20\le x\le2. To find P(0.5<X<1.5)P(0.5<X<1.5), should you integrate this expression or subtract two of its values?

The cdf has already accumulated probability. Its height gives an area under the density, so integrating the cdf would accumulate a different quantity. First see how a cdf is built.

You already know

A pdf ff gives interval probabilities by integration. The area over its whole support is one. A continuous model gives P(X=c)=0P(X=c)=0, so strict and inclusive endpoints give the same probability.

The lower-case ff and upper-case FF have different jobs. The cdf is dimensionless probability, whereas the pdf is density.

Cumulative distribution function

For a continuous random variable,

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

Here tt is a dummy integration variable. For support [a,b][a,b], the calculation is 00 below aa, ∫axf(t) dt\int_a^x f(t)\,dt inside, and 11 above bb; the integrals used here all have finite limits.

In the formula booklet.

A continuous variable's cdf is continuous, non-decreasing, lies between zero and one, and approaches zero and one at the two ends of the real line. Flat sections mean zero density. A corner is allowed; a jump would give positive point probability and does not describe the purely continuous models here.

Worked example 1: accumulating a piecewise density

Question. A continuous variable has pdf

f(x)={1/2,0≤x<12−x,1≤x≤20,otherwisef(x)= \begin{cases} 1/2,&0\le x<1\\ 2-x,&1\le x\le2\\ 0,&\text{otherwise} \end{cases}

Find its cdf and describe its sketch.

Plan. Accumulate from zero, retaining the probability already collected before x=1x=1.

For 0≤x<10\le x<1,

F(x)=∫0x12 dt=x2F(x)=\int_0^x\frac12\,dt=\frac x2

For 1≤x≤21\le x\le2,

F(x)=12+∫1x(2−t) dtinclude the first interval=12+[2t−t22]1xintegrate the second branch=2x−x22−1simplify\begin{aligned} F(x)&=\frac12+\int_1^x(2-t)\,dt&&\text{include the first interval}\\ &=\frac12+\left[2t-\frac{t^2}{2}\right]_1^x&&\text{integrate the second branch}\\ &=2x-\frac{x^2}{2}-1&&\text{simplify} \end{aligned}

Why this step? Beginning the second branch at zero would forget the probability 1/21/2 already lying below 11.

Answer.

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

The sketch is flat at zero, linear up to (1,1/2)(1,1/2), then rises with decreasing gradient to (2,1)(2,1), and stays flat.

Check. Both interior branches give 1/21/2 at 11, and the second gives 11 at 22. No cumulative probability is lost at a join.

Change only how much probability lies below 11: it is now 1/41/4, rather than 1/21/2. The falling branch is rescaled to keep total probability one.

Worked example 2: a different branch weight

Question. Find the cdf when the pdf is 1/41/4 on 0≤x<10\le x<1, 32(2−x)\frac32(2-x) on 1≤x≤21\le x\le2, and zero otherwise.

Plan. Carry probability 1/41/4 into the second branch.

F(x)=x40≤x<1F(x)=14+∫1x32(2−t) dt1≤x≤2=14+32(2x−x22−32)evaluate=3x−3x24−2simplify\begin{aligned} F(x)&=\frac x4&&0\le x<1\\ F(x)&=\frac14+\int_1^x\frac32(2-t)\,dt&&1\le x\le2\\ &=\frac14+\frac32\left(2x-\frac{x^2}{2}-\frac32\right)&&\text{evaluate}\\ &=3x-\frac{3x^2}{4}-2&&\text{simplify} \end{aligned}

Why this step? The second formula must start at 1/41/4 and rise by the remaining 3/43/4, not restart at zero.

Answer.

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

The sketch passes through (0,0)(0,0), (1,1/4)(1,1/4) and (2,1)(2,1), with constant exterior branches.

Check. F(1)=3−3/4−2=1/4F(1)=3-3/4-2=1/4 and F(2)=6−3−2=1F(2)=6-3-2=1, so both joins are continuous.

The cdf's final plateau is one, but its area is not required to be one. In fact its right-hand plateau continues indefinitely. The area-one condition belongs to the pdf.

[DIAGRAM: asset_name: Accumulating piecewise density without resetting; asset_slug: h645_b099_piecewise_cdf; caption: The cdf keeps its accumulated probability when the pdf changes rule; description: Two panels plot the complete cdfs from the worked examples, including flat zero and one branches. The first passes through one, one half and the second through one, one quarter. Each panel marks the join at x equals one and the endpoint at two, one, with labels placed outside the curves.]
The cdf keeps its accumulated probability when the pdf changes rule

Watch out

Wrong: use only ∫1xf(t) dt\int_1^x f(t)\,dt after the breakpoint. Right: add F(1)F(1). The second formula must join the first continuously.

Move the probability weight below 11 to 3/43/4.

Differentiate the cdf and check the whole support

A cdf's gradient measures how quickly probability is accumulating. A steep section means a large density; a flat section means no probability is being added.

Density from a cdf

Where the cdf is differentiable,

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

Differentiate each branch over its own interval. On a constant exterior branch, the density is zero. A density value at an isolated corner or endpoint can be chosen without changing any probability.

This follows from the supplied cdf integral; the derivative form is not printed separately.

Not in the formula booklet: learn it.

To establish that a proposed continuous cdf is valid, check its joins and endpoint values as well as its gradient. Showing that a few sampled values rise is not a proof that the entire function is non-decreasing.

Worked example 3: recovering a linear density

Question. A function is defined by F(x)=0F(x)=0 for x<0x<0, F(x)=x2/4F(x)=x^2/4 for 0≤x≤20\le x\le2, and F(x)=1F(x)=1 for x>2x>2. Show that it is a valid continuous cdf and find a corresponding pdf.

Plan. Check continuous joins and non-negative derivative, then differentiate the interior branch.

F(0)=0,F(2)=1joins and limiting valuesF′(x)=x2≥0(0<x<2)non-decreasing on the supportf(x)=x2(0<x<2)density is the gradient\begin{aligned} F(0)&=0,\qquad F(2)=1&&\text{joins and limiting values}\\ F'(x)&=\frac x2\ge0\quad(0<x<2)&&\text{non-decreasing on the support}\\ f(x)&=\frac x2\quad(0<x<2)&&\text{density is the gradient} \end{aligned}

Why this step? Correct endpoint values alone do not rule out a dip or an overshoot between them. The derivative establishes monotonicity throughout the interval.

Answer. The function is continuous, non-decreasing and has limits zero and one, so it is a valid continuous cdf. One pdf is f(x)=x/2f(x)=x/2 on [0,2][0,2], zero otherwise.

Check. ∫02(x/2) dx=[x2/4]02=1\int_0^2(x/2)\,dx=[x^2/4]_0^2=1.

Continue this lesson.

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

Create free account