6.3 - Mean, variance and percentiles

6.3 - Mean, variance and percentiles

A density describes a whole distribution, so it can tell you much more than the probability of one interval. In this part of 6.3, you will calculate its mean and variance, locate medians and other percentiles by area, and distinguish the distribution's average from its regions of greatest density.

Mean and variance from density

For the increasing density f(x)=2xf(x)=2x on 0≤x≤10\le x\le1, is the mean halfway along the interval? More probability is concentrated towards the right, so a mean greater than 0.50.5 is plausible. Integration gives its exact location.

For a discrete variable you added terms xP(X=x)x\mathrm P(X=x). A thin strip of continuous probability has approximate area f(x)Δxf(x)\Delta x. Its weighted contribution to the mean is approximately xf(x)Δxxf(x)\Delta x. Adding increasingly thin contributions leads to an integral.

Continuous expectation and variance

For a density f(x)f(x), integrate over the full support:

E(X)=∫xf(x) dxE(X2)=∫x2f(x) dxVar⁡(X)=E(X2)−{E(X)}2.\begin{aligned} \mathrm E(X)&=\int xf(x)\,\mathrm dx\\ \mathrm E(X^2)&=\int x^2f(x)\,\mathrm dx\\ \operatorname{Var}(X)&=\mathrm E(X^2)-\{\mathrm E(X)\}^2. \end{aligned}

These finite-moment formulae require the indicated integrals to converge. Standard deviation is Var⁡(X)\sqrt{\operatorname{Var}(X)}.

In the formula booklet, with the second-moment integral included in the variance formula.

The mean is a weighted location; variance is a weighted squared distance from it. As before, variance has squared units, and standard deviation has the original units. Keep the mean exact until its square has been subtracted.

Worked example 1: an increasing density

Question. XX has density f(x)=2xf(x)=2x for 0≤x≤10\le x\le1, and zero otherwise. Find its mean and variance.

Plan. Integrate xf(x)xf(x) and x2f(x)x^2f(x), then subtract the squared mean.

E(X)=∫012x2 dx=[2x33]01=23E(X2)=∫012x3 dx=[x42]01=12Var⁡(X)=12−(23)2=118.\begin{aligned} \mathrm E(X)&=\int_0^1 2x^2\,\mathrm dx=\left[\frac{2x^3}{3}\right]_0^1=\frac23\\ \mathrm E(X^2)&=\int_0^1 2x^3\,\mathrm dx=\left[\frac{x^4}{2}\right]_0^1=\frac12\\ \operatorname{Var}(X)&=\frac12-\left(\frac23\right)^2=\frac1{18}. \end{aligned}

Answer. Mean 2/32/3, variance 1/181/18.

Check. The direct squared-deviation integral gives
∫01(x−2/3)2(2x) dx=1/2−8/9+4/9=1/18\int_0^1(x-2/3)^2(2x)\,\mathrm dx=1/2-8/9+4/9=1/18. The mean is inside the support and lies to the right of its midpoint, as predicted.

Reflect the density in the vertical line x=1/2x=1/2. Its centre moves to the opposite side, but reflection preserves spread.

Worked example 2: a decreasing density

Question. YY has density g(y)=2(1−y)g(y)=2(1-y) for 0≤y≤10\le y\le1, and zero otherwise. Find its mean and variance.

Plan. Use the same two moment integrals with the reflected density.

E(Y)=∫01(2y−2y2) dy=[y2−2y33]01=13E(Y2)=∫01(2y2−2y3) dy=23−12=16Var⁡(Y)=16−(13)2=118.\begin{aligned} \mathrm E(Y)&=\int_0^1(2y-2y^2)\,\mathrm dy =\left[y^2-\frac{2y^3}{3}\right]_0^1=\frac13\\ \mathrm E(Y^2)&=\int_0^1(2y^2-2y^3)\,\mathrm dy =\frac23-\frac12=\frac16\\ \operatorname{Var}(Y)&=\frac16-\left(\frac13\right)^2=\frac1{18}. \end{aligned}

Answer. Mean 1/31/3, variance 1/181/18.

Check. A value y=1−xy=1-x reflects xx. The mean locations 1/31/3 and 2/32/3 add to 11, and equal variances agree with unchanged distances from the reflected centres.

For infinite support, keep a finite upper boundary until you have evaluated the integrals. The density's total area being finite does not by itself prove that every moment is finite.

Worked example 3: moments on an infinite support

Question. XX has density 3/x43/x^4 for x≥1x\ge1, and zero otherwise. Find its mean and variance.

Plan. Multiply the density by xx, then by x2x^2, and take each infinite-endpoint limit.

E(X)=lim⁡R→∞∫1R3x−3 dx=lim⁡R→∞(32−32R2)=32E(X2)=lim⁡R→∞∫1R3x−2 dx=lim⁡R→∞(3−3R)=3Var⁡(X)=3−(32)2=34.\begin{aligned} \mathrm E(X)&=\lim_{R\to\infty}\int_1^R3x^{-3}\,\mathrm dx =\lim_{R\to\infty}\left(\frac32-\frac{3}{2R^2}\right)=\frac32\\ \mathrm E(X^2)&=\lim_{R\to\infty}\int_1^R3x^{-2}\,\mathrm dx =\lim_{R\to\infty}\left(3-\frac3R\right)=3\\ \operatorname{Var}(X)&=3-\left(\frac32\right)^2=\frac34. \end{aligned}

Answer. Mean 3/23/2, variance 3/43/4.

Check. Direct integration of (x−3/2)2(3/x4)(x-3/2)^2(3/x^4) gives 3−9/2+9/4=3/43-9/2+9/4=3/4, using the convergent power integrals. Both moment limits are finite.

Change the power from x−4x^{-4} to x−5x^{-5}, with the normalising coefficient adjusted to 44. The faster decay puts less probability far to the right.

Worked example 4: a faster-decaying tail

Question. YY has density 4/y54/y^5 for y≥1y\ge1, and zero otherwise. Find its mean and variance.

Plan. Evaluate the same two improper moment integrals for the new power.

E(Y)=lim⁡R→∞∫1R4y−4 dy=lim⁡R→∞(43−43R3)=43E(Y2)=lim⁡R→∞∫1R4y−3 dy=lim⁡R→∞(2−2R2)=2Var⁡(Y)=2−169=29.\begin{aligned} \mathrm E(Y)&=\lim_{R\to\infty}\int_1^R4y^{-4}\,\mathrm dy =\lim_{R\to\infty}\left(\frac43-\frac4{3R^3}\right)=\frac43\\ \mathrm E(Y^2)&=\lim_{R\to\infty}\int_1^R4y^{-3}\,\mathrm dy =\lim_{R\to\infty}\left(2-\frac2{R^2}\right)=2\\ \operatorname{Var}(Y)&=2-\frac{16}{9}=\frac29. \end{aligned}

Answer. Mean 4/34/3, variance 2/92/9.

Check. Total area is lim⁡R→∞[−y−4]1R=1\lim_{R\to\infty}[ -y^{-4}]_1^R=1. The new mean and variance are both smaller than before, consistent with the more rapidly shrinking tail. Direct squared-deviation integration also gives 2−32/9+16/9=2/92-32/9+16/9=2/9.

Whether the support is bounded or infinite, calculate the two moments over its entire range before combining them.

Watch out

Integrating f(x)f(x) gives probability, integrating xf(x)xf(x) gives the mean, and integrating x2f(x)x^2f(x) gives the second moment. The second moment is not yet the variance: subtract the square of the mean.

Apply both moment formulae to a new power-tail density.

Medians and percentiles

The median divides probability in half, rather than dividing the support's length in half. For an increasing density, more area is packed into the right-hand end, so the median lies to the right of the interval's midpoint.

Median and percentile by area

A median mm satisfies P(X≤m)=1/2\mathrm P(X\le m)=1/2. A percentile qq leaves a specified percentage of probability below it: for 0<p<10<p<1, the percentile at percentage 100p100p satisfies P(X≤q)=p\mathrm P(X\le q)=p.

Find it by setting the area from the lower support boundary to the unknown value equal to the required probability. Use an improper lower-end limit if the support extends to minus infinity.

Continue this lesson.

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

Create free account