SR22, SR23 - Averages and spread from a pdf

SR22, SR23 - Averages and spread from a pdf

SR22 uses a density to calculate the mean, variance and standard deviation, including the continuous uniform model. SR23 finds the median by splitting probability in half and the mode by locating the density's maximum. The three measures of centre answer different questions.

Weight each value by its density

For the density f(x)=2xf(x)=2x on [0,1][0,1], is the average value the point that divides the probability into two equal halves? We will find both. A steadily rising density puts more weight towards 11, but it does not make all sensible measures of centre coincide.

The discrete probability-weighted sum becomes an integral: a thin strip near xx has probability approximately f(x) dxf(x)\,dx, so its contribution to the mean is approximately xf(x) dxx f(x)\,dx.

You already know

A pdf is non-negative with total area one. A mean is a probability-weighted value, and variance measures squared deviations from it. Write the relevant definite integral before calculator evaluation; split it if the density changes rule.

Use the support limits, not the endpoints of a probability interval from an earlier question. Expectation uses the whole distribution.

Continuous mean and variance

For a pdf ff on a finite support [a,b][a,b],

μ=E(X)=∫abxf(x) dx\mu=E(X)=\int_a^b x f(x)\,dx Var⁡(X)=∫ab(x−μ)2f(x) dx=∫abx2f(x) dx−μ2\operatorname{Var}(X)=\int_a^b(x-\mu)^2f(x)\,dx =\int_a^b x^2f(x)\,dx-\mu^2

The integral of x2f(x)x^2f(x) is E(X2)E(X^2), not E(X)2E(X)^2.

In the formula booklet.

Standard deviation is the non-negative square root of variance. It has the variable's original units; variance has squared units. This square-root relation is in the formula booklet.

Worked example 1: a rising linear density

Question. A continuous random variable has pdf f(x)=2xf(x)=2x for 0≤x≤10\le x\le1, and zero otherwise. Find its mean, variance and standard deviation.

Plan. Calculate the first two moments, then subtract the square of the mean from the second moment.

E(X)=∫01x(2x) dx=[2x33]01=23first momentE(X2)=∫01x2(2x) dx=[x42]01=12second momentVar⁡(X)=12−(23)2=118subtract mean squaredsd⁡(X)=118=26non-negative square root\begin{aligned} E(X)&=\int_0^1x(2x)\,dx=\left[\frac{2x^3}{3}\right]_0^1=\frac23&&\text{first moment}\\ E(X^2)&=\int_0^1x^2(2x)\,dx=\left[\frac{x^4}{2}\right]_0^1=\frac12&&\text{second moment}\\ \operatorname{Var}(X)&=\frac12-\left(\frac23\right)^2=\frac1{18}&&\text{subtract mean squared}\\ \operatorname{sd}(X)&=\sqrt{\frac1{18}}=\frac{\sqrt2}{6}&&\text{non-negative square root} \end{aligned}

Why this step? The density already weights the outcomes. Integrating xx alone would give the wrong mean.

Answer. Mean 2/32/3, variance 1/181/18, standard deviation 2/6\sqrt2/6.

Check. The mean is inside [0,1][0,1] and above its midpoint, as the density increases towards 11. The variance is positive.

Change only the power in the density, from a linear rise to a quadratic rise; the coefficient changes to keep total area one.

Worked example 2: more weight near the upper end

Question. Find the same measures when f(x)=3x2f(x)=3x^2 on [0,1][0,1], and zero otherwise.

Plan. Integrate xf(x)xf(x) and x2f(x)x^2f(x) over the unchanged support.

E(X)=∫013x3 dx=34first momentE(X2)=∫013x4 dx=35second momentVar⁡(X)=35−(34)2=380variance identitysd⁡(X)=380=1520simplify the root\begin{aligned} E(X)&=\int_0^1 3x^3\,dx=\frac34&&\text{first moment}\\ E(X^2)&=\int_0^1 3x^4\,dx=\frac35&&\text{second moment}\\ \operatorname{Var}(X)&=\frac35-\left(\frac34\right)^2=\frac3{80}&&\text{variance identity}\\ \operatorname{sd}(X)&=\sqrt{\frac3{80}}=\frac{\sqrt{15}}{20}&&\text{simplify the root} \end{aligned}

Why this step? Moving more probability close to 11 raises the mean but can reduce the spread: the two measures need not rise together.

Answer. Mean 3/43/4, variance 3/803/80, standard deviation 15/20\sqrt{15}/20.

Check. 3/4>2/33/4>2/3, while 3/80<1/183/80<1/18. The steeper density concentrates values near the upper end.

A negative variance signals an error. Check whether you squared the mean, integrated the whole support and retained enough precision before subtracting.

Watch out

Wrong: Var⁡(X)=E(X2)−E(X)\operatorname{Var}(X)=E(X^2)-E(X). Right: subtract [E(X)]2[E(X)]^2. Also E(X2)E(X^2) is usually different from [E(X)]2[E(X)]^2.

Increase the power once more and keep the calculations exact.

A uniform interval has a midpoint and a width

For a continuous uniform distribution on [a,b][a,b], every equal-length subinterval has the same probability. The constant density must therefore be 1/(b−a)1/(b-a) on the interval and zero elsewhere.

Its mean is the midpoint. Its variance depends on the interval's width, so shifting the whole interval changes the mean without changing the spread.

Continuous uniform moments

If XX is uniformly distributed over [a,b][a,b], where a<ba<b,

E(X)=a+b2,Var⁡(X)=(b−a)212E(X)=\frac{a+b}{2},\qquad \operatorname{Var}(X)=\frac{(b-a)^2}{12}

In the formula booklet.

The results may still need deriving if the question asks. Starting from the constant density,

E(X)=1b−a∫abx dx=a+b2E(X2)=1b−a∫abx2 dx=a2+ab+b23Var⁡(X)=a2+ab+b23−(a+b)24=(b−a)212\begin{aligned} E(X)&=\frac1{b-a}\int_a^b x\,dx=\frac{a+b}{2}\\ E(X^2)&=\frac1{b-a}\int_a^b x^2\,dx=\frac{a^2+ab+b^2}{3}\\ \operatorname{Var}(X)&=\frac{a^2+ab+b^2}{3}-\frac{(a+b)^2}{4} =\frac{(b-a)^2}{12} \end{aligned}

The density 1/(b−a)1/(b-a) and this derivation are not printed separately: obtain them from total area one and the supplied moment integrals.

Worked example 3: waiting within a uniform interval

Question. A waiting time XX, in minutes, is modelled by a continuous uniform distribution on [2,8][2,8]. Find its mean, variance and standard deviation.

Plan. Use the interval midpoint and squared width.

E(X)=2+82=5 minmidpointVar⁡(X)=(8−2)212=3 min2squared widthsd⁡(X)=3 minoriginal units\begin{aligned} E(X)&=\frac{2+8}{2}=5\,\mathrm{min}&&\text{midpoint}\\ \operatorname{Var}(X)&=\frac{(8-2)^2}{12}=3\,\mathrm{min^2}&&\text{squared width}\\ \operatorname{sd}(X)&=\sqrt3\,\mathrm{min}&&\text{original units} \end{aligned}

Why this step? The spread depends on 8−28-2, rather than on the upper endpoint alone.

Answer. Mean 5 min5\,\mathrm{min}, variance 3 min23\,\mathrm{min^2}, standard deviation 3 min\sqrt3\,\mathrm{min}.

Check. Directly, E(X2)=16∫28x2 dx=28E(X^2)=\frac16\int_2^8x^2\,dx=28, so the variance is 28−52=328-5^2=3.

Change only the upper endpoint from 88 to 1010. The midpoint moves and the interval widens.

Continue this lesson.

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

Create free account