Course guide

2.1 Data and measurement

Types, supports and the structure of records

2.1.1What is being measured?

Before calculating a probability or an average, identify the unit being studied and the feature recorded for that unit. A unit might be a person, household, firm, country or examination script. A variable describes a feature whose recorded value can vary across units or across occasions. The numbers alone do not tell us what their differences mean: a category code and an income measurement require different interpretations.

For a numerical random variable, the probability experiment and its measurement are connected by X:Ω→RX:\Omega\to\mathbb R. Each outcome in the sample space Ω\Omega receives a numerical value. For example, selecting a script is the experiment; its mark is the value of XX. Several distinct scripts can receive the same mark. Capital XX names the uncertain measurement; lower-case xx names one possible value.

Measurement determines which comparisons are meaningful
TypeMeaningExample
Nominal categoricalLabels identify groups; ordering and differences need not have meaning.Eye colour; employment coded 00 or 11.
Ordinal categoricalOrder has meaning, but equal gaps or ratios are not established.Poor, fair and good coded 0,1,20,1,2.
Discrete numericalDistinct numerical values describe meaningful quantities.The number of people in a household.
Continuous numericalA model allows a continuum of values in an interval.Height, handspan or a lifetime.

A binary indicator deserves special attention. Coding employed as 11 and unemployed as 00 makes its average the proportion employed. That interpretation follows from the chosen coding; an average of arbitrary eye-colour codes does not have an analogous meaning. Likewise, ordinal codes preserve ranking without establishing that the improvement from poor to fair equals the improvement from fair to good.

Measurement precision and a probability model are different choices. Wages recorded to the nearest penny are discrete records, but a continuous approximation may be useful. A rounded age is not proof that age itself is restricted to whole years. State which approximation is being used and what it is intended to describe.

2.1.2Support and several measurements

The support identifies values the model permits. A binary indicator has support {0,1}\{0,1\}; a six-sided die has support {1,2,3,4,5,6}\{1,2,3,4,5,6\}; a finite nonnegative lifetime can be modelled on [0,∞)[0,\infty). Discrete supports need not be integers: a variable taking only 0.50.5 and 1.51.5 is discrete. A continuous support need not include every real number.

For a discrete distribution we usually list the values with positive probability. For a distribution with a density, support is described by the range where density can occur, including boundary points where appropriate. An observed sample range is not necessarily the population support: not observing an extreme value does not make it impossible.

A univariate measurement records one feature. A bivariate measurement records two, and a multivariate measurement records several. A household with five children whose youngest is four years old can be represented by the vector X=(5,4)\mathbf X=(5,4). The coordinates mean different things and must retain their labels. Height, weight and eye colour also form a multivariate record, even though the last coordinate is categorical.

One unit, two coordinates

A household record with five children and youngest child age four
55
44
(5,4)(5,4)
Number of children\text{Number of children}
Age of youngest child\text{Age of youngest child}
The horizontal and vertical coordinates describe the same household. Axis meanings determine what the pair records.

A number-line plot can show one measurement per unit; a scatter plot can show two. Each point in a scatter plot represents a paired record from the same unit. Combining the height of one person with the weight of another would change the joint data and destroy information about their relationship. Three numerical features form points in three-dimensional space; more features remain meaningful even when they cannot be pictured directly.

2.1.3Cross-sections, time series and panels

A cross-section records units at a specified occasion. With NN units, write {Xi}i=1N\{X_i\}_{i=1}^{N}, where ii identifies a unit. Repeated values are still separate records: three students with mark 3030 are three observations, not one.

A time series records measurements in temporal order. Write {Xt}t=1T\{X_t\}_{t=1}^{T}, where tt identifies time and TT is the number of recorded occasions. A plot of date against value helps show how the series changes. Reordering the values generally changes its meaning because its timing contains information.

There is another useful perspective: the entire path (X1,…,XT)(X_1,\ldots,X_T) is one realization of a TT-dimensional random vector. A three-year GDP path is one point with coordinates for the three years, as well as three points in a date–value plot. Neither representation establishes independent observations. Whether components can be used as independent evidence requires assumptions about the process generating the path.

A panel follows several units over time. Write XitX_{it}: the first index identifies a unit and the second an occasion. A balanced panel observes every unit on the same complete set of occasions. An unbalanced panel has a different observed time set for some units, perhaps because units enter or leave or measurements are missing. A panel therefore combines cross-sectional and temporal variation; it does not automatically eliminate dependence within a unit.

StructureRecordQuestion to ask
Cross-sectionUnit ii, measurement XiX_iWhich population and occasion?
Time seriesDate tt, measurement XtX_tWhich time order and spacing?
PanelUnit ii, date tt, measurement XitX_{it}Which unit–date combinations are observed?

2.1.4Check the interpretation before calculating

1. Codes and quantities

A survey codes poor, fair and good health as 0,1,20,1,2. Does a response of 22 establish twice as much health as a response of 11? What does an employment indicator’s mean measure?

Solution
  1. Measurement. The health codes establish ordering, not a ratio scale. “Twice as much health” is not supported by the coding.
  2. Indicator. Each employed person contributes one and each other person zero. The sum counts employed people.
  3. Average. Dividing that count by the number of people gives the employed proportion.

2. Identify the structure

A dataset records GDP for 2020 countries in each of 55 years, except that one country lacks the last two records. Describe its structure and count its records. Does this count prove independence?

Solution
  1. Indices. Country and year give two indices, so this is panel data.
  2. Missing combinations. The panel is unbalanced; the count is 20(5)−2=9820(5)-2=98.
  3. Dependence. Counting rows does not establish independence. Within-country histories and common year shocks can create relationships between records.

2.2 Discrete distributions

Masses, indicators and counting successes

2.2.1From records to probability masses

Variation can be described by assigning a probability to each possible measurement. For a discrete variable, a probability mass function, abbreviated PMF, gives that assignment. Discrete values may form a finite or countably infinite list. Probability belongs to each listed value; it is not determined by the space between values on a plot.

Consider the marks of ten scripts:

30,30,30,60,60,80,80,80,90,100.\begin{aligned}&30,30,30,60,60,\\ &80,80,80,90,100.\end{aligned}

Select one script uniformly from this pile and let XX be its mark. “Uniformly” means each script has probability 1/101/10. Three scripts have mark 3030, so the event X=30X=30 contains three distinct selection outcomes and has probability 3/103/10. Combining equal marks gives:

Mark xxCountP(X=x)P(X=x)
3030330.30.3
6060220.20.2
8080330.30.3
9090110.10.1
100100110.10.1
Total101011

Definition. The PMF of XX is pX(x)=P(X=x)p_X(x)=P(X=x), with pX(x)≥0p_X(x)\geq0 and

∑xpX(x)=1.\sum_xp_X(x)=1.

The sum runs over distinct values, not individual scripts. Outside the support, the PMF is zero: no script here has mark 7070. For an event involving several marks, add their masses. Thus P(X≥80)=0.3+0.1+0.1=0.5P(X\geq80)=0.3+0.1+0.1=0.5.

If the script is replaced and the pile shuffled before each new uniform draw, the same PMF applies each time and independent sampling can be modelled. A draw without replacement has this same first-draw PMF, but subsequent probabilities depend on what was removed. The pile’s relative frequencies exactly describe uniform selection from this pile; treating them as the distribution of a larger student population is a further inferential step.

The pile gives masses at distinct marks

Five mark values with probabilities 0.3, 0.2, 0.3, 0.1 and 0.1
3030
6060
8080
9090
100100
0.30.3
0.10.1
pX(x)p_X(x)
Stem heights are probabilities of individual marks. The distance between marks does not allocate additional probability.

2.2.2Bernoulli and categorical distributions

A Bernoulli variable records whether an event occurs: X=1X=1 for success and X=0X=0 otherwise. Fix one convention throughout: p=P(X=1)p=P(X=1). Then

P(X=1)=p,P(X=0)=1−p.\begin{aligned}P(X=1)&=p,\\P(X=0)&=1-p.\end{aligned}

For 0<p<10<p<1, both outcomes have positive probability, and one compact PMF covers them:

pX(x)=px(1−p)1−x,x∈{0,1}.\begin{gathered}p_X(x)=p^x(1-p)^{1-x},\\x\in\{0,1\}.\end{gathered}

Setting x=1x=1 leaves pp; setting x=0x=0 leaves 1−p1-p. The two-outcome formula above also handles p=0p=0 or p=1p=1 directly, without needing an endpoint convention for 000^0.

For a fair coin, code heads as 11; then p=1/2p=1/2. For a hypothetical weighted coin with heads probability 9/109/10, the masses at 00 and 11 are 0.10.1 and 0.90.9. “Success” is a label chosen for the event, not necessarily a desirable outcome. Changing that coding changes the parameter’s interpretation.

A categorical distribution, also called a generalized Bernoulli or multinoulli distribution, extends the idea to kk categories, with probabilities p1,…,pkp_1,\ldots,p_k. Each pjp_j is nonnegative and the probabilities sum to one. The categories can be named or associated with numerical values x1,…,xkx_1,\ldots,x_k. The marks distribution is categorical over its five distinct marks, while the marks themselves retain numerical meaning.

The Iverson bracket converts a statement into a number: 1{x=xj}\mathbf1\{x=x_j\} is one when the equality is true and zero otherwise. An alternative notation is [x=xj][x=x_j]. With this indicator,

pX(x)=∑j=1kpj 1{x=xj}.p_X(x)=\sum_{j=1}^{k}p_j\,\mathbf1\{x=x_j\}.

Only the term matching the selected value contributes. The formula is a compact version of the table, not a different probability model.

2.2.3New variables and summation notation

A transformation creates a new measurement Y=g(X)Y=g(X). To find its distribution, collect the probabilities of all original values producing the same new value:

P(Y=y)=∑x:g(x)=ypX(x).P(Y=y)=\sum_{x:g(x)=y}p_X(x).

Read the condition under the sum as “over the x values for which g of x equals y.” For an illustrative pass rule of at least 6060, define Y=1{X≥60}Y=\mathbf1\{X\geq60\}. Four distinct marks contribute to Y=1Y=1, so P(Y=1)=0.2+0.3+0.1+0.1=0.7P(Y=1)=0.2+0.3+0.1+0.1=0.7. The mark distribution and pass distribution describe the same scripts at different resolutions.

The capital Greek letter sigma, ∑\sum, abbreviates addition. For an indexed list X1,X2,X3X_1,X_2,X_3,

∑i=13Xi=X1+X2+X3,∑i=23Xi=X2+X3.\begin{aligned}\sum_{i=1}^{3}X_i&=X_1+X_2+X_3,\\ \sum_{i=2}^{3}X_i&=X_2+X_3.\end{aligned}

The index ii tells us which terms to include; its lower and upper limits matter. The product symbol ∏\prod, capital pi, abbreviates multiplication:

∏i=13Xi=X1X2X3.\prod_{i=1}^{3}X_i=X_1X_2X_3.

For binary observations, the sum counts ones. Their average, Xˉ=N−1∑i=1NXi\bar X=N^{-1}\sum_{i=1}^{N}X_i, is therefore the proportion of successes. Its possible values are {0,1/N,2/N,…,1}\{0,1/N,2/N,\ldots,1\}. Although it can have many decimal values when NN is large, it remains discrete for fixed NN. Infinite sums are also written with sigma notation, but a finite value requires the relevant series to converge.

2.2.4Counting successes: the binomial distribution

Suppose NN trials are independent, each has the same success probability pp, and each produces a Bernoulli outcome XiX_i. The count Y=∑i=1NXiY=\sum_{i=1}^{N}X_i has a binomial distribution, written Y∼Bin⁡(N,p)Y\sim\operatorname{Bin}(N,p). For 0<p<10<p<1, its support is {0,1,…,N}\{0,1,\ldots,N\}. At p=0p=0 it is always zero, so the support reduces to {0}\{0\}; at p=1p=1 it is always NN, with support {N}\{N\}.

  1. One ordered sequence. A particular sequence with kk successes and N−kN-k failures has probability pk(1−p)N−kp^k(1-p)^{N-k}, by independence.
  2. Count sequences. There are (Nk)\binom Nk ways to choose the success positions. Read this as “N choose k.”
  3. Add disjoint outcomes. The event of exactly kk successes includes every such sequence, so
P(Y=k)=(Nk)pk(1−p)N−k.P(Y=k)=\binom Nk p^k(1-p)^{N-k}.

The combinatorial multiplier depends on NN and kk, rather than being one constant across all counts. Using n!=n(n−1)⋯1n!=n(n-1)\cdots1, read “n factorial,” and 0!=10!=1, it is (Nk)=N!/[k!(N−k)!]\binom Nk=N!/[k!(N-k)!]. The binomial theorem verifies that the masses sum to (p+(1−p))N=1(p+(1-p))^N=1.

For three fair tosses and exactly two heads, the sequences are HHT, HTH and THH. Each has probability 1/81/8; adding them gives 3/83/8. Counting only one sequence would lose two thirds of the event. With N=10N=10, p=1/2p=1/2 and k=5k=5, the probability is 252/1024=0.24609375252/1024=0.24609375.

Increasing NN from 1010 to 1515 to 2020 expands the count’s support. For fixed N=10N=10, compare p=1/3,1/2,0.9p=1/3,1/2,0.9: the first places more mass near small counts with a right tail, the second is symmetric, and the third concentrates near ten with a left tail. At p=1/2p=1/2, the distribution is symmetric and its variance is largest among binomials with that fixed NN. Expectations and variances below will explain these shape changes algebraically.

2.2.5Worked checks on masses and multiplicity

1. A transformed mark

Define Z=1{X<80}Z=\mathbf1\{X<80\} for the ten-script pile. Give the support and PMF of ZZ. What assumption connects the table to a draw?

Solution
  1. Support. The indicator takes 00 or 11.
  2. Collect original masses. P(Z=1)=P(X=30)+P(X=60)=0.3+0.2=0.5P(Z=1)=P(X=30)+P(X=60)=0.3+0.2=0.5; the complementary mass is P(Z=0)=0.5P(Z=0)=0.5.
  3. Selection. Each script must be equally likely to be selected for the pile frequencies to be its mark probabilities.

2. Exactly one success

There are 44 independent trials, each with success probability 0.20.2. Find the probability of exactly one success and the possible values of the sample proportion.

Solution
  1. Binomial assumptions. Independence and a common success probability permit the binomial PMF.
  2. Multiplicity. The success can occupy any of four positions.
  3. Calculate. P(Y=1)=4(0.2)(0.8)3=0.4096P(Y=1)=4(0.2)(0.8)^3=0.4096.
  4. Rescale the support. The proportion Y/4Y/4 can take 0,1/4,1/2,3/4,10,1/4,1/2,3/4,1.

2.3 Continuous densities

Intervals, density heights and distribution families

2.3.1Probability per unit of measurement

A finite counting model assigns probability to separate values. For a variable with a continuous density, probability instead belongs to intervals. A probability density function, abbreviated PDF, tells us how much probability is concentrated per unit of measurement near a value.

At a point where the density is continuous, its local interpretation is

fX(x)=lim⁡h↓0P(x<X≤x+h)h,P(x<X≤x+h)≈fX(x)h.\begin{gathered}f_X(x)=\lim_{h\downarrow0}\frac{P(x<X\leq x+h)}{h},\\ P(x<X\leq x+h)\approx f_X(x)h.\end{gathered}

The approximation uses a small positive interval width hh. Density is the probability divided by width, so its units are the reciprocal of the variable’s units. If lifetimes are measured in hours, density has units per hour.

Density requirements. A density is nonnegative and has total area one:

fX(x)≥0,∫−∞∞fX(x) dx=1.\begin{aligned}f_X(x)&\geq0,\\ \int_{-\infty}^{\infty}f_X(x)\,dx&=1.\end{aligned}

Read the integral as “integrate f sub X of x over all x.” An interval’s probability is its area under the curve:

P(a<X≤b)=∫abfX(x) dx.P(a<X\leq b)=\int_a^bf_X(x)\,dx.

The density value fX(x)f_X(x) is not itself a probability. It may exceed one without violating any probability rule. For a variable with a density, P(X=x)=0P(X=x)=0: a point has zero width and hence zero area. The probability of observing some real value is still one; probability is not obtained by summing point masses over an uncountable interval.

A density histogram illustrates the distinction. If a bin of width ww contains proportion rr of observations, its density height is r/wr/w; its area remains rr. Narrowing bins can reveal a distribution’s shape when enough observations are available. With a fixed small dataset, arbitrarily narrow bins do not automatically produce a smooth population density. The discrete ten-script mark distribution remains a PMF unless a different, continuous model is deliberately introduced.

2.3.2The uniform density: calculate with rectangles

For X∼U(a,b)X\sim U(a,b), read “X has a uniform distribution from a to b,” assume a<ba<b. Equal-length intervals inside the support have equal probabilities. Its density is constant:

fX(x)={1/(b−a),a≤x≤b,0,otherwise.f_X(x)=\begin{cases}1/(b-a),&a\leq x\leq b,\\0,&\text{otherwise}.\end{cases}
  1. Width. The support has length b−ab-a.
  2. Normalization. A rectangle with height cc has total area (b−a)c(b-a)c. Set this to one.
  3. Solve. The height must be c=1/(b−a)c=1/(b-a).
  4. Restrict the interval. For a≤c<d≤ba\leq c<d\leq b, its probability is (d−c)/(b−a)(d-c)/(b-a).

The symbols c,dc,d in the last step label interval endpoints, not the temporary height in the normalization step. More generally, clip an interval to the support before measuring its width. Parts outside [a,b][a,b] carry no probability.

Shorter support requires a taller density

Three uniform density rectangles with equal total area
U(0,1)U(0,1)
00
11
fX=1f_X=1
U(−1,1)U(-1,1)
−1-1
11
fX=0.5f_X=0.5
U(1.5,2)U(1.5,2)
1.51.5
22
fX=2f_X=2
Every rectangle has area one. The density height changes inversely with support width, so the last height is two rather than a probability of two.
DistributionSupport widthDensity heightTotal area
U(0,1)U(0,1)111111
U(−1,1)U(-1,1)221/21/211
U(1.5,2)U(1.5,2)1/21/22211

For the last distribution, density 22 is compatible with probability one because its width is only 1/21/2. The interval from 1.51.5 to 1.751.75 has width 1/41/4, so its probability is 2(1/4)=1/22(1/4)=1/2.

Before playing, predict: can a density be greater than 11? And what is the probability of one exact value?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. U(−1,1):U(-1,1)\text{:} a rectangle of width 22 and height 1/21/2 has area 1.1\text{.}
  2. Squeeze the support to (0,1):(0,1)\text{:} the height doubles to 11 and the area stays 1.1\text{.}
  3. Squeeze again to (1.5,2):(1.5,2)\text{:} height 2,2\text{,} area still 1.1\text{.} A height above 11 is allowed, because it is a density, not a probability.
  4. Zoom in: the probability of (1.6,1.9](1.6,1.9] is its area, 0.3×2=0.6.0.3\times2=0.6\text{.}
  5. Shrink the interval to the point 1.7:1.7\text{:} its area, and so its probability, falls to 00 while the height stays 2.2\text{.}

2.3.3A normal family has location and spread

The normal distribution, also called Gaussian, is a family of bell-shaped densities. Write X∼N(μ,σ2)X\sim N(\mu,\sigma^2), where μ\mu is its mean and σ>0\sigma>0 its standard deviation. The second parameter in this notation is the variance, σ2\sigma^2, not the standard deviation. Those measures are developed formally in the moments chapters.

One readable way to write the density introduces the standardized distance z=(x−μ)/σz=(x-\mu)/\sigma:

z=x−μσ,fX(x)=1σ2πexp⁡(−z2/2).\begin{aligned}z&=\frac{x-\mu}{\sigma},\\ f_X(x)&=\frac{1}{\sigma\sqrt{2\pi}}\exp(-z^2/2).\end{aligned}

The exponential term decreases with squared distance from the centre. Dividing the distance by σ\sigma makes the same relative shape work at different scales; dividing the height by σ\sigma keeps the total area one when the horizontal scale expands.

Changing μ\mu from −1-1 to 00 to 22, while keeping σ=1\sigma=1, shifts the curve without changing its spread. Keeping μ=0\mu=0 and changing σ\sigma from 0.50.5 to 11 to 22 produces increasingly wide, lower curves. Their areas remain one; a lower peak does not mean that the total probability is smaller.

Shift location or change spread

Same spread

Normal curves with means minus one, zero and two and standard deviation one
μ=−1,0,2; σ=1\mu=-1,0,2;\ \sigma=1
00

Same centre

Normal curves centred at zero with standard deviations one half, one and two
μ=0; σ=0.5,1,2\mu=0;\ \sigma=0.5,1,2
00
Solid, dashed and dotted curves identify the listed parameter values in order. The vertical density scale is shared. Every curve integrates to one.

A normal distribution’s mathematical support is the entire real line. A bell shape alone does not establish that a measurement is normal, and the model can be inappropriate when hard boundaries or heavy tails matter. Normal probabilities describe areas, not curve heights. The next chapter supplies the cumulative function needed to calculate them.

2.3.4Density, height and probability

1. A height greater than one

Let X∼U(1.5,2)X\sim U(1.5,2). Find fX(1.7)f_X(1.7), P(1.6<X<1.9)P(1.6<X<1.9), and P(X=1.7)P(X=1.7).

Solution
  1. Density height. fX(1.7)=1/(2−1.5)=2f_X(1.7)=1/(2-1.5)=2.
  2. Interval area. Its width is 1.9−1.6=0.31.9-1.6=0.3, so the probability is 2(0.3)=0.62(0.3)=0.6.
  3. A point. P(X=1.7)=0P(X=1.7)=0, because the point has zero width. Density and probability answer different questions.

2. Clip to the support

For X∼U(−1,1)X\sim U(-1,1), find P(−2<X≤0.5)P(-2<X\leq0.5). Why is multiplying the full interval width by the density incorrect?

Solution
  1. Retain supported values. Only [−1,0.5][-1,0.5] contributes.
  2. Area. Its width is 1.51.5 and density is 1/21/2, giving probability 0.750.75.
  3. Check. The full width 2.52.5 would give 1.251.25, an impossible probability, because it includes values outside the support.

2.4 Cumulative distributions and quantiles

Thresholds, endpoints and reversing probability questions

2.4.1Accumulating probability up to a threshold

The cumulative distribution function, or CDF, answers one repeated question: what is the probability of a value no greater than a threshold? Define it for every real threshold xx, including gaps in a discrete support:

FX(x)=P(X≤x).F_X(x)=P(X\leq x).

For a discrete variable, add all masses at or below xx. For a variable with a density, accumulate area from the far left up to xx:

FX(x)=∑u≤xpX(u),FX(x)=∫−∞xfX(u) du.\begin{aligned}F_X(x)&=\sum_{u\leq x}p_X(u),\\F_X(x)&=\int_{-\infty}^{x}f_X(u)\,du.\end{aligned}

These are alternative constructions for the discrete and density cases. The dummy variable uu represents values being accumulated; xx remains the chosen threshold.

For the ten-script pile, the cumulative masses at marks 30,60,80,90,10030,60,80,90,100 are respectively 0.3,0.5,0.8,0.9,10.3,0.5,0.8,0.9,1. Between marks, nothing new is added. Thus FX(29.999)=0F_X(29.999)=0, FX(30)=0.3F_X(30)=0.3, FX(30.01)=0.3F_X(30.01)=0.3, and FX(70)=0.5F_X(70)=0.5. The function is a staircase, not a smooth curve.

A jump adds the probability at its mark

Right-continuous cumulative mark probabilities shown as a staircase
3030
6060
8080
9090
100100
00
0.50.5
11
FX(x)F_X(x)
Filled points give the value at each threshold; open points show the excluded left limit. No new probability is added between supported marks.

Every CDF lies between zero and one, is nondecreasing, approaches zero far to the left, and approaches one far to the right. It is right-continuous: its value at a jump includes the mass at that threshold. A discrete CDF need not be continuous. For a distribution with a density, the CDF is continuous, but need not be differentiable at every point, as a uniform distribution’s endpoints illustrate.

2.4.2Interval probabilities and endpoint choices

An interval probability subtracts the mass already accumulated before the interval from the mass accumulated through its upper endpoint:

P(a<X≤b)=FX(b)−FX(a),P(X>x)=1−FX(x).\begin{aligned}P(a<X\leq b)&=F_X(b)-F_X(a),\\P(X>x)&=1-F_X(x).\end{aligned}

The first expression excludes aa, because its mass is included in the subtracted FX(a)F_X(a). For discrete variables, changing an endpoint from strict to inclusive can change the answer. Write FX(a−)F_X(a^-) for the CDF limit just below aa, read “F sub X at a from the left.” Then

P(a≤X≤b)=FX(b)−FX(a−),P(X=a)=FX(a)−FX(a−).\begin{gathered}P(a\leq X\leq b)\\=F_X(b)-F_X(a^-),\\P(X=a)=F_X(a)-F_X(a^-).\end{gathered}

For the marks, P(30<X≤80)=0.8−0.3=0.5P(30<X\leq80)=0.8-0.3=0.5, whereas P(30≤X≤80)=0.8−0=0.8P(30\leq X\leq80)=0.8-0=0.8. The difference is the three scripts marked 3030. For a variable with a density, endpoint masses are zero, so these strict and inclusive versions coincide.

For X∼U(a,b)X\sim U(a,b), accumulating the rectangle’s area gives

FX(x)={0,x<a,x−ab−a,a≤x≤b,1,x>b.F_X(x)=\begin{cases}0,&x<a,\\\dfrac{x-a}{b-a},&a\leq x\leq b,\\1,&x>b.\end{cases}

For U(0,2)U(0,2), FX(0.8)=0.4F_X(0.8)=0.4 and FX(1.5)=0.75F_X(1.5)=0.75; their difference is 0.350.35. The same area can be found directly from width times height. Where the CDF is differentiable, its slope is the density: fX(x)=FX′(x)f_X(x)=F_X'(x). A steep CDF means probability accumulates quickly in that region, not that cumulative probability can exceed one.

2.4.3Reverse the question: quantiles

A probability calculation starts with a threshold and finds a probability. A quantile starts with a probability and finds a threshold. The pp-quantile, for 0<p<10<p<1, can be defined by

QX(p)=inf⁡{x:FX(x)≥p}.Q_X(p)=\inf\{x:F_X(x)\geq p\}.

Read inf⁡\inf as “infimum,” the lowest threshold satisfying the condition. For a continuous strictly increasing CDF this is the inverse function and solves FX(x)=pF_X(x)=p. The inequality definition also works at jumps, where no threshold may have exactly the requested cumulative probability.

The median corresponds to p=0.5p=0.5; quartiles use 0.25,0.5,0.750.25,0.5,0.75; deciles use tenths; percentiles use hundredths. In a CDF plot, start at the requested probability on the vertical axis, move to the curve, then read the threshold on the horizontal axis. For a uniform distribution, solve the linear CDF:

p=x−ab−a,QX(p)=a+(b−a)p.\begin{aligned}p&=\frac{x-a}{b-a},\\Q_X(p)&=a+(b-a)p.\end{aligned}

For the marks, the lower-quantile convention gives QX(0.25)=30Q_X(0.25)=30, QX(0.5)=60Q_X(0.5)=60, and QX(0.75)=80Q_X(0.75)=80. A conventional sample median averages the fifth and sixth ordered records, giving (60+80)/2=70(60+80)/2=70. These are different conventions for a distribution with a gap at its halfway point. Every value between 6060 and 8080 satisfies the usual median inequalities; specify the convention when a unique numerical answer is needed.

As a continuous example, a normal model N(5,4)N(5,4) has its 1010th percentile near 2.442.44, first quartile near 3.653.65, median 55, third quartile near 6.356.35, and 9090th percentile near 7.567.56. Standardisation will show how these numbers are obtained from one common reference distribution.

2.4.4Normal areas and table reading

For a standard normal variable Z∼N(0,1)Z\sim N(0,1), write its CDF as Φ(z)\Phi(z), pronounced “capital phi of z.” It is an S-shaped cumulative curve, while its density is bell-shaped. Normal areas have no elementary antiderivative; numerical routines or probability tables calculate them.

Selected standard normal cumulative probabilities
Threshold zzΦ(z)\Phi(z)
−2.33-2.330.00990.0099
−2-20.02280.0228
−1.02-1.020.15390.1539
−1-10.15870.1587
−0.5-0.50.30850.3085
000.50000.5000
0.670.670.74860.7486
0.680.680.75170.7517
110.84130.8413
1.961.960.97500.9750
220.97720.9772

In a two-dimensional table, a row such as 1.91.9 and a column such as 0.060.06 identify z=1.96z=1.96. A negative-value table may use row −2.3-2.3 and column 0.030.03 to identify −2.33-2.33; inspect its sign convention. The entry is a left-tail probability, not a density height. At −2.33-2.33, that probability is about one percent, 0.00990.0099, rather than 0.0990.099.

  1. Left tail. P(Z≤−1.02)=Φ(−1.02)=0.1539P(Z\leq-1.02)=\Phi(-1.02)=0.1539.
  2. Right tail. P(Z≥1)=1−Φ(1)=0.1587P(Z\geq1)=1-\Phi(1)=0.1587. Normal symmetry also gives Φ(−1)=1−Φ(1)\Phi(-1)=1-\Phi(1).
  3. Interval. For −0.5≤Z≤2-0.5\leq Z\leq2, subtract the left tails:
P(−0.5≤Z≤2)=Φ(2)−Φ(−0.5)≈0.9772−0.3085=0.6687.\begin{aligned}&P(-0.5\leq Z\leq2)\\&\quad=\Phi(2)-\Phi(-0.5)\\&\quad\approx0.9772-0.3085\\&\quad=0.6687.\end{aligned}

To find the third quartile from the table, 0.750.75 lies between 0.74860.7486 at 0.670.67 and 0.75170.7517 at 0.680.68. Linear interpolation uses the fraction of the probability gap traversed:

r=0.75−0.74860.7517−0.7486,z≈0.67+0.01r≈0.674516.\begin{aligned}r&=\frac{0.75-0.7486}{0.7517-0.7486},\\z&\approx0.67+0.01r\\&\approx0.674516.\end{aligned}

A more precise numerical inverse gives 0.6744900.674490. Interpolation is an approximation between rounded table entries, not a claim that the normal CDF is exactly linear there.

Quantiles and central intervals answer different questions
QuestionAnswer
77th percentile−1.475791-1.475791
8787th percentile1.1263911.126391
9595th percentile; upper tail 0.050.051.6448541.644854
97.597.5th percentile1.9599641.959964
Central 90%90\%Approximately ±1.645\pm1.645
Central 95%95\%Approximately ±1.96\pm1.96
Central 99%99\%Approximately ±2.5758\pm2.5758

A central 95%95\% interval leaves 2.5%2.5\% in each tail. Its upper endpoint is therefore the 97.597.5th percentile, not the 9595th. In particular P(∣Z∣≥1.645)≈0.10P(|Z|\geq1.645)\approx0.10, while ±2.5758\pm2.5758 describes a central 99%99\% interval. These probabilities belong to the specified normal model.

2.4.5Work from the event to its cumulative probabilities

1. Endpoints in the mark distribution

Find P(60<X≤90)P(60<X\leq90), P(60≤X≤90)P(60\leq X\leq90), and P(X>80)P(X>80).

Solution
  1. Exclude the lower endpoint. FX(90)−FX(60)=0.9−0.5=0.4F_X(90)-F_X(60)=0.9-0.5=0.4.
  2. Include it. FX(60−)=0.3F_X(60^-)=0.3, so 0.9−0.3=0.60.9-0.3=0.6.
  3. Complement. P(X>80)=1−FX(80)=0.2P(X>80)=1-F_X(80)=0.2.

2. A uniform quantile

Find the 7575th percentile of U(−1,1)U(-1,1), then check its CDF.

Solution
  1. Inverse. x=−1+2(0.75)=0.5x=-1+2(0.75)=0.5.
  2. Check. FX(0.5)=(0.5+1)/2=0.75F_X(0.5)=(0.5+1)/2=0.75.

3. One tail or two?

Why does the normal 9595th percentile not give an upper endpoint for a symmetric central 95%95\% interval?

Solution
  1. One-tail quantile. The 9595th percentile leaves 5%5\% above it.
  2. Symmetry. Using its negative as the lower endpoint also leaves 5%5\% below, so only 90%90\% remains centrally.
  3. Required tails. A central 95%95\% interval needs 2.5%2.5\% in each tail, giving endpoints about ±1.96\pm1.96.

2.5 Expected values

Probability-weighted averages and transformations

2.5.1The mean is a probability-weighted balance

A distribution records the full allocation of probability. An expected value summarizes its location by weighting each value according to how much probability it receives. “Expectation,” “mean” and “expected value” refer to the same mathematical object. Expectation does not mean the outcome that will occur, or necessarily the outcome that occurs most often.

Definition. For a finite expected value, assume E[∣X∣]<∞E[|X|]<\infty. Then

For a discrete distribution,

E[X]=∑xx pX(x).E[X]=\sum_x x\,p_X(x).

For a distribution with a density,

E[X]=∫−∞∞xfX(x) dx.E[X]=\int_{-\infty}^{\infty}x f_X(x)\,dx.

Values with more probability exert more influence; impossible values exert none. The integrability condition prevents infinite positive and negative contributions from being treated as if they cancelled. All finite-support examples here satisfy it.

For the ten-script pile, averaging individual marks and averaging distinct marks with their probabilities give the same result:

E[X]=30(0.3)+60(0.2)+80(0.3)+90(0.1)+100(0.1)=9+12+24+9+10=64.\begin{aligned}E[X]&=30(0.3)+60(0.2)\\&\quad+80(0.3)+90(0.1)\\&\quad+100(0.1)\\&=9+12+24+9+10\\&=64.\end{aligned}

The individual records sum to 640640, so their ordinary mean is also 640/10=64640/10=64. Grouping repeated marks changes the calculation’s organization, not its result. The mean is the balance point of the probability weights: E[X−μ]=0E[X-\mu]=0.

The mean need not be a supported value

Mark probability masses with a mean at 64 between observed values
3030
6060
8080
9090
100100
0.30.3
0.10.1
pX(x)p_X(x)
μ=64\mu=64
The dashed line locates the probability-weighted mean; the stems remain at the five possible marks. Values on both sides balance in their weighted deviations.

No script has mark 6464, yet it is the expected mark of a uniform selection. A fair die likewise has mean (1+2+3+4+5+6)/6=3.5(1+2+3+4+5+6)/6=3.5, which is not a possible face. The modes of the mark distribution are 3030 and 8080, each with probability 0.30.3; neither equals the mean. These examples separate an average from a prediction of one exact outcome.

2.5.2Indicators and continuous averages

For a Bernoulli indicator with P(X=1)=pP(X=1)=p,

E[X]=0(1−p)+1p=p.E[X]=0(1-p)+1p=p.

Its expectation is the probability of the event coded one. For the blue-eye indicator record 1,0,0,1,1,0,1,0,0,01,0,0,1,1,0,1,0,0,0, four of ten entries are one. Its mean is 0.40.4, the proportion coded blue-eyed. This is an average of indicators, not an average eye colour.

For a uniform variable, the mean is its midpoint. Derive it by weighting each value with the constant density:

E[X]=1b−a∫abx dx=b2−a22(b−a)=a+b2.\begin{aligned}E[X]&=\frac{1}{b-a}\int_a^bx\,dx\\&=\frac{b^2-a^2}{2(b-a)}\\&=\frac{a+b}{2}.\end{aligned}

Thus U(10,20)U(10,20) has mean 1515. For N(μ,σ2)N(\mu,\sigma^2), the mean is μ\mu. Its density is symmetric about μ\mu, so equal probability weights at opposite distances cancel in the expectation of X−μX-\mu. This argument relies on the mean existing; symmetry alone is not sufficient.

2.5.3Transform values first, then average

For a function gg, the expectation of the transformed measurement is found using the original probability weights:

E[g(X)]=∑xg(x)pX(x),E[g(X)]=∫g(x)fX(x) dx.\begin{aligned}E[g(X)]&=\sum_x g(x)p_X(x),\\E[g(X)]&=\int g(x)f_X(x)\,dx.\end{aligned}

The first expression is for discrete values and the second for a density. This method avoids constructing the transformed distribution when only its average is required. It also makes clear that averaging and transforming are two separate operations.

For squared marks,

E[X2]=302(0.3)+602(0.2)+802(0.3)+902(0.1)+1002(0.1)=4720.\begin{aligned}E[X^2]&=30^2(0.3)+60^2(0.2)\\&\quad+80^2(0.3)+90^2(0.1)\\&\quad+100^2(0.1)\\&=4720.\end{aligned}

Squaring the mean instead gives 642=409664^2=4096. The difference comes from variation around the mean. It will become the variance in the next chapter.

Linearity. For constants a,ba,b and integrable variables,

E[a+bX]=a+bE[X],E[X+Y]=E[X]+E[Y].\begin{aligned}E[a+bX]&=a+bE[X],\\E[X+Y]&=E[X]+E[Y].\end{aligned}
  1. Expand the weighted sum. Each term of E[a+bX]E[a+bX] is (a+bx)pX(x)(a+bx)p_X(x).
  2. Separate terms. Sum the constant part and the variable part separately.
  3. Normalize. The constant part is a∑xpX(x)=aa\sum_xp_X(x)=a; the remaining part is bE[X]bE[X].

The same separation works for integrals and for sums of variables. Addition does not require independence. Multiplication is different: independence gives E[XY]=E[X]E[Y]E[XY]=E[X]E[Y], when the required expectations exist. Without that condition, the joint distribution determines the average product. More generally, independent variables also allow E[g(X)h(Y)]=E[g(X)]E[h(Y)]E[g(X)h(Y)]=E[g(X)]E[h(Y)] under integrability.

For NN binary trials with common success probability pp, linearity gives E[∑iXi]=NpE[\sum_iX_i]=Np and E[Xˉ]=pE[\bar X]=p. Independence is unnecessary for these two mean identities; it is needed for the binomial distribution of the count.

2.5.4Nonlinearity and the existence of moments

A convex function bends upward: a straight segment joining two points on its graph lies on or above the graph. A concave function reverses that geometry. Jensen’s inequality, pronounced “YEN-sen’s inequality,” extends that comparison to probability-weighted averages, assuming the relevant expectations exist:

For convex gg,

E[g(X)]≥g(E[X]).E[g(X)]\geq g(E[X]).

For concave gg,

E[g(X)]≤g(E[X]).E[g(X)]\leq g(E[X]).

Squaring and exponentiation are convex; logarithms on positive values and square roots on nonnegative values are concave. Consequently E[X2]≥(E[X])2E[X^2]\geq(E[X])^2, E[eX]≥eE[X]E[e^X]\geq e^{E[X]}, E[log⁡X]≤log⁡E[X]E[\log X]\leq\log E[X] for positive XX, and E[X]≤E[X]E[\sqrt X]\leq\sqrt{E[X]} for nonnegative XX. Equality can occur, for example when there is no variation; “nonlinear” does not automatically mean every instance is strictly unequal.

Ratios also need care. Suppose two paired outcomes (X,Y)=(1,1)(X,Y)=(1,1) and (1,2)(1,2) are equally likely. Then E[X/Y]=(1+1/2)/2=3/4E[X/Y]=(1+1/2)/2=3/4, while E[X]/E[Y]=1/(3/2)=2/3E[X]/E[Y]=1/(3/2)=2/3. Averaging ratios is not generally the same as taking the ratio of averages.

Why a symmetric density can have no mean

The standard Cauchy density is f(x)=1/[π(1+x2)]f(x)=1/[\pi(1+x^2)]. Its tails decrease much more slowly than normal tails. Its positive first-moment integral contains

∫0∞x1+x2 dx,\int_0^\infty\frac{x}{1+x^2}\,dx,

which diverges, since an antiderivative is 12log⁡(1+x2)\tfrac12\log(1+x^2). The negative side also has infinite magnitude. Symmetric cancellation in a principal-value calculation is not a finite expectation; the Cauchy mean and variance do not exist. A distribution’s plausible-looking central shape does not establish the existence of its moments or the rarity of its extreme observations.

2.5.5Choose the correct order of operations

1. An affine change of marks

The marks are transformed by Y=5+0.8XY=5+0.8X. Find E[Y]E[Y]. Is independence relevant?

Solution
  1. Linearity. E[Y]=5+0.8E[X]E[Y]=5+0.8E[X].
  2. Use the existing mean. 5+0.8(64)=56.25+0.8(64)=56.2.
  3. Assumptions. This is a function of one variable; linearity, not independence, justifies the calculation.

2. Square before averaging

For a fair die, find E[X2]E[X^2] and compare it with (E[X])2(E[X])^2.

Solution
  1. Average transformed values. E[X2]=(1+4+9+16+25+36)/6=91/6E[X^2]=(1+4+9+16+25+36)/6=91/6.
  2. Transform the average. (E[X])2=(7/2)2=49/4(E[X])^2=(7/2)^2=49/4.
  3. Compare. Their difference is 91/6−49/4=35/12>091/6-49/4=35/12>0, consistent with convexity of squaring.

3. Does an expected value have to be possible?

A payoff is 00 with probability 0.90.9 and 100100 with probability 0.10.1. Find its mean and mode.

Solution
  1. Weighted mean. 0(0.9)+100(0.1)=100(0.9)+100(0.1)=10.
  2. Most likely value. The mode is 00.
  3. Interpretation. The mean 1010 is a probability-weighted summary, despite not being a possible payoff.

2.6 Variance and standard deviation

Squared deviations, units and spread

2.6.1Why square deviations?

Two distributions can have the same mean and very different spread. Ordinary deviations cannot summarize spread by their average, because positive and negative deviations from the mean cancel: E[X−μ]=0E[X-\mu]=0. Squaring prevents that cancellation, weights larger deviations more strongly, and produces a nonnegative summary.

Definition. With finite second moment and μ=E[X]\mu=E[X],

Var⁡(X)=E[(X−μ)2].\operatorname{Var}(X)=E[(X-\mu)^2].

Read “variance of X.” This is the second central moment. The raw second moment is E[X2]E[X^2]; it is related to variance but is not the same object.

  1. Expand the square. (X−μ)2=X2−2μX+μ2(X-\mu)^2=X^2-2\mu X+\mu^2.
  2. Apply linearity. The fixed μ\mu can be taken outside the expectation.
  3. Substitute the mean. Since E[X]=μE[X]=\mu,
Var⁡(X)=E[X2]−2μE[X]+μ2=E[X2]−μ2.\begin{aligned}\operatorname{Var}(X)&=E[X^2]-2\mu E[X]\\&\quad+\mu^2\\&=E[X^2]-\mu^2.\end{aligned}

For a PMF, variance is ∑x(x−μ)2pX(x)\sum_x(x-\mu)^2p_X(x); for a density, it is ∫(x−μ)2fX(x) dx\int(x-\mu)^2f_X(x)\,dx. Its nonnegativity follows directly from averaging squared deviations. A finite-variance variable has variance zero exactly when it equals a constant with probability one.

The standard deviation is the square root:

σ=SD⁡(X)=Var⁡(X).\sigma=\operatorname{SD}(X)=\sqrt{\operatorname{Var}(X)}.

The mean is in the variable’s original units; variance is in squared units; standard deviation returns to the original units. For income measured in pounds, variance is in pounds squared and standard deviation is in pounds.

2.6.2The same marks, now measuring spread

For the mark distribution, μ=64\mu=64, E[X2]=4720E[X^2]=4720, and μ2=4096\mu^2=4096. Therefore

Var⁡(X)=4720−4096=624,SD⁡(X)=624≈24.98.\begin{aligned}\operatorname{Var}(X)&=4720-4096=624,\\\operatorname{SD}(X)&=\sqrt{624}\approx24.98.\end{aligned}
Direct weighted-deviation check
Mark xxDeviation x−64x-64Weighted square
3030−34-340.3(342)=346.80.3(34^2)=346.8
6060−4-40.2(42)=3.20.2(4^2)=3.2
808016160.3(162)=76.80.3(16^2)=76.8
909026260.1(262)=67.60.1(26^2)=67.6
10010036360.1(362)=129.60.1(36^2)=129.6
Total624624
Before playing, predict: what is the probability-weighted average of the deviations from the mean, 6464? Why can it not measure spread?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. Five marks with probabilities 0.3,0.3\text{,} 0.2,0.2\text{,} 0.3,0.3\text{,} 0.10.1 and 0.10.1 balance at their mean, 64.64\text{.}
  2. Their deviations, −34,-34\text{,} −4,-4\text{,} 16,16\text{,} 2626 and 36,36\text{,} cancel once weighted by probability: E[X−μ]=0.E[X-\mu]=0\text{.}
  3. Squaring stops the cancelling: each deviation becomes a square, which then shrinks to its probability share.
  4. The weighted squares, 346.8+3.2+76.8+67.6+129.6,346.8+3.2+76.8+67.6+129.6\text{,} pool into one square of area 624624 marks²: the variance.
  5. Its side, 624≈24.98\sqrt{624}\approx24.98 marks, is the standard deviation, back in the original units: 64±24.98.64\pm24.98\text{.}

This variance describes a uniform draw from the known pile of ten scripts, so the record-based calculation divides by ten. An estimator of an unknown population variance from a random sample may use a different denominator. That later estimation problem should not be confused with the variance of this fully specified distribution.

For a change of units Y=a+bXY=a+bX, the mean becomes a+bμa+b\mu. Its deviation is Y−E[Y]=b(X−μ)Y-E[Y]=b(X-\mu), so

Var⁡(a+bX)=b2Var⁡(X),SD⁡(a+bX)=∣b∣SD⁡(X).\begin{aligned}\operatorname{Var}(a+bX)&=b^2\operatorname{Var}(X),\\\operatorname{SD}(a+bX)&=|b|\operatorname{SD}(X).\end{aligned}

A shift changes location without changing spread. Multiplication changes spread by the magnitude of the multiplier; a negative multiplier also reverses order. If marks were expressed as proportions rather than percentages, the standard deviation would be 24.98/10024.98/100, while variance would be 624/1002624/100^2.

2.6.3Variances of useful distributions

For a Bernoulli variable with success probability pp, the identity X2=XX^2=X holds because its only values are zero and one. Hence

Var⁡(X)=E[X2]−(E[X])2=p−p2=p(1−p)=14−(p−12)2.\begin{aligned}\operatorname{Var}(X)&=E[X^2]-(E[X])^2\\&=p-p^2=p(1-p)\\&=\frac14-(p-\tfrac12)^2.\end{aligned}

The variance is zero when all probability is on one outcome and largest at p=1/2p=1/2. Knowing a binary variable’s mean determines its variance, and indeed its whole Bernoulli distribution. For general numerical variables, knowing the mean alone does not determine spread.

For U(a,b)U(a,b), write L=b−aL=b-a and centre the variable at (a+b)/2(a+b)/2. Its deviations are uniform from −L/2-L/2 to L/2L/2, so

Var⁡(X)=1L∫−L/2L/2u2 du=L212=(b−a)212.\begin{aligned}\operatorname{Var}(X)&=\frac1L\int_{-L/2}^{L/2}u^2\,du\\&=\frac{L^2}{12}=\frac{(b-a)^2}{12}.\end{aligned}

Thus U(10,20)U(10,20) has variance 100/12100/12 and standard deviation 10/12≈2.88710/\sqrt{12}\approx2.887. For N(μ,σ2)N(\mu,\sigma^2), the parameters are directly its mean and variance. The notation is consistent across normal probability calculations: use σ=σ2\sigma=\sqrt{\sigma^2} when dividing a distance by standard deviation.

For independent Bernoulli trials, the variance of their sum is Np(1−p)Np(1-p). Independence makes the cross-covariance terms vanish; the association chapter will derive the general sum-variance rule. The variance of their average is p(1−p)/Np(1-p)/N, explaining why a proportion can concentrate even while the success count’s numerical spread grows with NN.

2.6.4Standard deviation as a common distance unit

When σ>0\sigma>0, the standardized measurement is Z=(X−μ)/σZ=(X-\mu)/\sigma. Its mean is zero and variance one. A value of 11 is one standard deviation above the mean; a value of −2-2 is two below. This change of units works for any finite positive variance, but it does not turn every distribution into a normal distribution.

For a normal model, central probabilities are approximately 68.27%68.27\% within one standard deviation, 95.45%95.45\% within two, and 99.73%99.73\% within three. This is often called the empirical rule. A central 95%95\% normal interval uses about 1.961.96 standard deviations, rather than exactly two. A six-standard-deviation event is exceptionally rare under a normal model, but its rarity cannot be inferred from the number of standard deviations alone if the distribution has heavy tails.

The next chapter combines this common unit with the standard normal CDF to calculate probabilities and quantiles. Keep two questions separate: how far a value lies from the mean in standard deviations, and how much probability the assumed distribution puts beyond that distance.

2.6.5Spread and transformations

1. Shift and scale

For the mark distribution, define Y=10−2XY=10-2X. Find its mean, variance and standard deviation.

Solution
  1. Mean. E[Y]=10−2(64)=−118E[Y]=10-2(64)=-118.
  2. Variance. Var⁡(Y)=(−2)2(624)=2496\operatorname{Var}(Y)=(-2)^2(624)=2496.
  3. Standard deviation. SD⁡(Y)=2624≈49.96\operatorname{SD}(Y)=2\sqrt{624}\approx49.96. A negative scale cannot create a negative spread.

2. A binary distribution

A Bernoulli variable has mean 0.90.9. Find its variance. Compare it with a Bernoulli variable of mean 0.50.5.

Solution
  1. Identify the success probability. p=E[X]=0.9p=E[X]=0.9.
  2. Variance. 0.9(0.1)=0.090.9(0.1)=0.09.
  3. Comparison. At p=0.5p=0.5, variance is 0.250.25. The distribution near all successes is less variable than the half-and-half distribution.

2.7 Normal standardisation

Translate probabilities and quantiles between scales

2.7.1Translate a normal model without changing the event

Standard normal probabilities can serve every normal distribution because shifting and scaling a normal variable preserves its normal shape. If X∼N(μ,σ2)X\sim N(\mu,\sigma^2) and Y=a+bXY=a+bX, with b≠0b\ne0, then

Y∼N(a+bμ,b2σ2).Y\sim N(a+b\mu,b^2\sigma^2).

The new mean follows linearity of expectation; the new variance follows the squared-deviation rule. The standard deviation is ∣b∣σ|b|\sigma. With b=0b=0, the result is a constant rather than a variable with a nondegenerate normal density.

Track the two normal parameters separately
Starting modelTransformationResult
N(5,4)N(5,4)X+10X+10N(15,4)N(15,4)
N(5,4)N(5,4)X−5X-5N(0,4)N(0,4)
N(1,2)N(1,2)2X2XN(2,8)N(2,8)
N(1,2)N(1,2)−3X-3XN(−3,18)N(-3,18)

Subtracting the mean centres a normal variable without altering variance. Dividing by standard deviation then sets the variance to one:

X−μ∼N(0,σ2),Z=X−μσ∼N(0,1).\begin{aligned}X-\mu&\sim N(0,\sigma^2),\\Z=\frac{X-\mu}{\sigma}&\sim N(0,1).\end{aligned}

Read ZZ as a new random variable; read z=(x−μ)/σz=(x-\mu)/\sigma as the transformed numerical threshold. The distinction matters: standardising the distribution and standardising the event’s endpoints are two parts of the same operation.

2.7.2Probabilities: preserve the inequality and choose its area

Because σ>0\sigma>0, subtracting μ\mu and dividing by σ\sigma preserves an inequality’s direction. Therefore

P(X≤x)=Φ(x−μσ),P(X≥x)=1−Φ(x−μσ).\begin{aligned}P(X\leq x)&=\Phi\left(\frac{x-\mu}{\sigma}\right),\\P(X\geq x)&=1-\Phi\left(\frac{x-\mu}{\sigma}\right).\end{aligned}

For an interval, transform both endpoints and subtract their left-tail probabilities. Dividing by a negative multiplier in some other transformation would reverse inequalities; standardisation itself uses a positive standard deviation.

Example 1: a left tail

Let X∼N(−1,9)X\sim N(-1,9). The standard deviation is 33, not 99. For P(X≤2)P(X\leq2),

z=2−(−1)3=1,P(X≤2)=Φ(1)≈0.8413.\begin{aligned}z&=\frac{2-(-1)}{3}=1,\\P(X\leq2)&=\Phi(1)\approx0.8413.\end{aligned}

The threshold is one standard deviation above the mean. A probability above one half is consistent with its location.

Before playing, predict: to standardise X∼N(−1,9),X\sim N(-1,9)\text{,} do we divide by 99 or by 33? And does the shaded area change?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. X∼N(−1,9)X\sim N(-1,9) has σ=9=3,\sigma=\sqrt9=3\text{,} not 9.9\text{.} The probability P(X≤2)P(X\le2) is the shaded area.
  2. Subtract the mean μ=−1:\mu=-1\text{:} the curve and the threshold slide together by +1.+1\text{.} Now X−μ∼N(0,9)X-\mu\sim N(0,9) and the threshold is 2−(−1)=3.2-(-1)=3\text{.}
  3. Divide by σ=3:\sigma=3\text{:} the curve becomes three times narrower and three times taller, and the threshold becomes 3/3=1.3/3=1\text{.} The shaded area does not change.
  4. So P(X≤2)=P(Z≤1)=Φ(1)≈0.8413:P(X\le2)=P(Z\le1)=\Phi(1)\approx0.8413\text{:} the threshold is one standard deviation above the mean.

Example 2: keep track of table rounding

For X∼N(4,1/2)X\sim N(4,1/2), find P(X≤3.5)P(X\leq3.5):

σ=1/2,z=3.5−41/2≈−0.707107,P(X≤3.5)≈0.23975.\begin{aligned}\sigma&=\sqrt{1/2},\\z&=\frac{3.5-4}{\sqrt{1/2}}\\&\approx-0.707107,\\P(X\leq3.5)&\approx0.23975.\end{aligned}

Rounding the standardized threshold first to −0.71-0.71 and using a two-decimal table gives 0.23890.2389. The difference is rounding, not a different model. Keep unrounded values for numerical calculations and state the approximation when using a table.

Example 3: a right tail

For X∼N(0.2,1.5)X\sim N(0.2,1.5), find P(X≥1.6)P(X\geq1.6):

z=1.6−0.21.5≈1.143095,P(X≥1.6)=1−Φ(z)≈0.12650.\begin{aligned}z&=\frac{1.6-0.2}{\sqrt{1.5}}\\&\approx1.143095,\\P(X\geq1.6)&=1-\Phi(z)\\&\approx0.12650.\end{aligned}

A table lookup at the rounded 1.141.14 gives 1−0.8729=0.12711-0.8729=0.1271. Forgetting the complement would report the probability below the threshold.

Example 4: two endpoints

For X∼N(−2,6)X\sim N(-2,6), find P(−3≤X≤−1.2)P(-3\leq X\leq-1.2):

zlower=−3−(−2)6≈−0.408248,zupper=−1.2−(−2)6≈0.326599,P(−3≤X≤−1.2)=Φ(zupper)−Φ(zlower)≈0.28647.\begin{gathered}z_{\rm lower}=\frac{-3-(-2)}{\sqrt6}\\\approx-0.408248,\\z_{\rm upper}=\frac{-1.2-(-2)}{\sqrt6}\\\approx0.326599,\\P(-3\leq X\leq-1.2)\\=\Phi(z_{\rm upper})-\Phi(z_{\rm lower})\\\approx0.28647.\end{gathered}

The two bounds surround the mean. Draw or identify that central segment before subtracting; the interval is zlower≤Z≤zupperz_{\rm lower}\leq Z\leq z_{\rm upper}, with both inequalities pointing consistently.

2.7.3Quantiles: transform back into original units

Given a probability pp, first find its standard normal quantile zp=Φ−1(p)z_p=\Phi^{-1}(p), read “phi inverse of p.” Then undo the standardisation:

zp=xp−μσ,xp=μ+σzp.\begin{aligned}z_p&=\frac{x_p-\mu}{\sigma},\\x_p&=\mu+\sigma z_p.\end{aligned}

A normal distribution’s median is its mean, because z0.5=0z_{0.5}=0. Thus the median of N(−1,9)N(-1,9) is −1-1. For the third decile of N(4,1/2)N(4,1/2), use p=0.3p=0.3:

z0.3≈−0.5244005,x0.3=4+1/2(−0.5244005)≈3.629193.\begin{aligned}z_{0.3}&\approx-0.5244005,\\x_{0.3}&=4+\sqrt{1/2}(-0.5244005)\\&\approx3.629193.\end{aligned}

A quantile below the median should be below the mean, a useful direction check. For N(5,4)N(5,4), standard deviation is 22; transforming the standard quantiles gives the earlier values 2.44,3.65,5,6.35,7.562.44,3.65,5,6.35,7.56 at probabilities 0.1,0.25,0.5,0.75,0.90.1,0.25,0.5,0.75,0.9.

A reliable calculation follows four steps: write the event or requested probability; distinguish variance from standard deviation; translate the threshold or probability to the standard normal; translate the final answer back if the question asks for a value. A probability has no measurement units; a quantile has the variable’s units.

2.7.4Calculate and check the direction

1. An upper tail

Let X∼N(5,4)X\sim N(5,4). Find P(X>7)P(X>7).

Solution
  1. Scale. σ=4=2\sigma=\sqrt4=2.
  2. Threshold. z=(7−5)/2=1z=(7-5)/2=1.
  3. Upper tail. P(X>7)=1−Φ(1)≈0.1587P(X>7)=1-\Phi(1)\approx0.1587.
  4. Check. A threshold above the mean has an upper-tail probability below one half.

2. A central interval in original units

Find an approximately central 95%95\% interval for N(−1,9)N(-1,9).

Solution
  1. Standard endpoints. Central 95%95\% uses approximately −1.96-1.96 and 1.961.96.
  2. Transform back. Multiply by 33, then add −1-1.
  3. Result. The interval is [−6.88,4.88][-6.88,4.88]. Using the 9595th percentile 1.6451.645 instead would leave only 90%90\% centrally.

3. Standardized does not mean normal

Does (X−E[X])/SD⁡(X)(X-E[X])/\operatorname{SD}(X) have a standard normal distribution whenever the standard deviation is positive?

Solution

No. It has mean zero and variance one, but retains the original distribution’s shape under the affine change. Standardising a uniform variable gives another uniform variable, not a bell curve. Normality of XX is the assumption that permits standard normal probability calculations.

2.8 Joint, marginal and conditional distributions

Pair measurements, integrate margins and normalize slices

2.8.1Keep paired measurements together

A joint distribution describes measurements made together. For two dice, XX might be the first die and YY the second. An outcome is a pair, not two unrelated lists. In a class record, a mark and a group indicator must refer to the same student if their relationship is to be studied.

Joint cumulative distribution.

FX,Y(x,y)=P(X≤x, Y≤y).F_{X,Y}(x,y)=P(X\leq x,\ Y\leq y).

The comma means both inequalities hold. It accumulates probability in the region below both thresholds. For discrete variables, the joint PMF is pX,Y(x,y)=P(X=x,Y=y)p_{X,Y}(x,y)=P(X=x,Y=y). It is nonnegative and its sum over all pairs is one:

∑x∑ypX,Y(x,y)=1.\sum_x\sum_y p_{X,Y}(x,y)=1.

For a joint density fX,Yf_{X,Y}, interval rectangles receive probabilities by integration:

P(a<X≤b, c<Y≤d)=∫ab∫cdfX,Y(x,y) dy dx.\begin{aligned}&P(a<X\leq b,\ c<Y\leq d)\\&\quad=\int_a^b\int_c^d f_{X,Y}(x,y)\,dy\,dx.\end{aligned}

A joint density’s total volume is one, and a single pair has zero probability. When the cumulative function is sufficiently differentiable, fX,Y(x,y)=∂2FX,Y(x,y)/(∂x ∂y)f_{X,Y}(x,y)=\partial^2F_{X,Y}(x,y)/(\partial x\,\partial y).

For two independent fair dice, all 3636 pairs have mass 1/361/36. The joint probability P(X≤2,Y≤3)P(X\leq2,Y\leq3) contains six pairs, so it is 6/36=1/66/36=1/6. Different joint distributions can have the same individual distributions: knowing each die’s separate probabilities does not determine how their values are paired.

Joint cells, marginal totals

Six by six joint probability table for independent fair dice
11
11
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
22
22
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
33
33
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
44
44
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
55
55
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
66
66
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
136\frac1{36}
Columns identify the first die and rows the second. Each cell is one paired outcome. Adding a row or a column gives a marginal probability of one sixth; selecting a row and normalizing gives a conditional distribution.

2.8.2Marginalise by adding over the other measurement

A marginal distribution describes one variable without conditioning on the other. To obtain it, retain every possible value of the other coordinate and add their joint probabilities. The name is reflected in a table: its row and column totals sit in the margins.

pX(x)=∑ypX,Y(x,y),pY(y)=∑xpX,Y(x,y).\begin{aligned}p_X(x)&=\sum_y p_{X,Y}(x,y),\\p_Y(y)&=\sum_x p_{X,Y}(x,y).\end{aligned}

For a continuous joint density, sums become integrals:

fX(x)=∫−∞∞fX,Y(x,y) dy,fY(y)=∫−∞∞fX,Y(x,y) dx.\begin{aligned}f_X(x)&=\int_{-\infty}^{\infty}f_{X,Y}(x,y)\,dy,\\f_Y(y)&=\int_{-\infty}^{\infty}f_{X,Y}(x,y)\,dx.\end{aligned}

Marginalising is not the same as slicing. A slice fixes a coordinate; a marginal combines its whole range. For the independent fair dice, a row has six cells of mass 1/361/36, giving a marginal mass 1/61/6. A column gives the same result for the other die.

Variables are independent when their joint probabilities factor into marginal probabilities for all relevant events. For discrete values this is pX,Y(x,y)=pX(x)pY(y)p_{X,Y}(x,y)=p_X(x)p_Y(y). For densities the analogous factorisation holds almost everywhere, and for cumulative functions it is FX,Y(x,y)=FX(x)FY(y)F_{X,Y}(x,y)=F_X(x)F_Y(y). Checking one cell is insufficient to establish independence; the relationship must describe the whole distribution.

2.8.3A conditional distribution is a normalized slice

In a discrete model, conditioning on a value with positive marginal probability uses the familiar event ratio:

pY∣X(y∣x)=pX,Y(x,y)pX(x).p_{Y\mid X}(y\mid x)=\frac{p_{X,Y}(x,y)}{p_X(x)}.

The numerator keeps the slice at the selected XX value; division by its XX-marginal probability makes the conditional masses sum to one. In the dice grid, that slice is a column because XX labels the horizontal axis. For independent dice, the numerator is 1/361/36 and the denominator 1/61/6, so the conditional mass remains 1/61/6: learning one die’s value does not change the other die’s distribution.

For variables with a joint density, the corresponding conditional-density construction is, where fX(x)>0f_X(x)>0,

fY∣X(y∣x)=fX,Y(x,y)fX(x).f_{Y\mid X}(y\mid x)=\frac{f_{X,Y}(x,y)}{f_X(x)}.

This is a density construction, not division by the point probability P(X=x)P(X=x), which is zero. The raw slice has area fX(x)f_X(x); dividing by that area normalizes it. Conditional densities can be specified at suitable conditioning values, or almost everywhere, without applying the elementary event ratio to a zero-probability event.

A geometric model where the slice changes

As an explicit hypothetical model, take constant joint density 22 on the triangle 0<x<y<10<x<y<1, and zero elsewhere. Its triangular area is 1/21/2, so total probability is 2(1/2)=12(1/2)=1.

Integrate a slice, then normalize it

Uniform joint density on the triangle zero less than x less than y less than one
00
11
11
fX,Y=2f_{X,Y}=2
Y=3/4Y=3/4
y=xy=x
XX
YY
The triangle carries constant density two, so its total volume is one. The horizontal segment at Y equal to three quarters has width three quarters: its raw slice integrates to three halves and its conditional density is four thirds.
  1. Marginal of YY. At a fixed yy, the horizontal slice runs from x=0x=0 to x=yx=y, giving fY(y)=∫0y2 dx=2yf_Y(y)=\int_0^y2\,dx=2y, for 0<y<10<y<1.
  2. Conditional density of XX. Divide that slice by its total: fX∣Y(x∣y)=2/(2y)=1/yf_{X\mid Y}(x\mid y)=2/(2y)=1/y, for 0<x<y0<x<y.
  3. Interpretation. X∣Y=yX\mid Y=y is uniform from zero to yy. Increasing the known yy permits a wider range of XX, rather than leaving its distribution unchanged.
  4. Other marginal. Fixing xx and integrating from y=xy=x to one gives fX(x)=2(1−x)f_X(x)=2(1-x), for 0<x<10<x<1.

At y=1/2y=1/2, the conditional density is 22 over width 1/21/2; at y=3/4y=3/4, it is 4/34/3 over width 3/43/4. Both areas are one. The joint density is not the product of these marginals, so the variables are dependent. Two-dimensional geometry helps distinguish a volume, an integrated marginal, and a renormalized slice without requiring a three-dimensional perspective drawing.

2.8.4A joint table for the original class

To connect distributions with group averages, now let YY denote a student’s mark and XX the class record’s group indicator: 11 for women and 00 for men. The earlier mark variable has been renamed YY; the values have not changed. Pair the ten marks with the recorded indicator sequence 0,0,0,1,1,0,1,0,1,00,0,0,1,1,0,1,0,1,0. Uniformly selecting a student gives:

Joint probabilities from paired class records
Mark yyX=0X=0X=1X=1Mark marginal
30300.30.3000.30.3
6060000.20.20.20.2
80800.20.20.10.10.30.3
9090000.10.10.10.1
1001000.10.1000.10.1
Group marginal0.60.60.40.411

For example, P(Y=80∣X=1)=0.1/0.4=1/4P(Y=80\mid X=1)=0.1/0.4=1/4, while P(Y=80∣X=0)=0.2/0.6=1/3P(Y=80\mid X=0)=0.2/0.6=1/3. The numerator represents a joint group–mark event, not the whole mark marginal 0.30.3. Marginalizing across groups recovers the original mark distribution; conditioning on a group creates a different normalized mark distribution. The conditional-expectation chapter will average these distributions.

2.8.5Marginal, conditional or joint?

1. One cell and one margin

Using the class table, find P(Y=60)P(Y=60), P(X=1,Y=60)P(X=1,Y=60), and P(X=1∣Y=60)P(X=1\mid Y=60).

Solution
  1. Mark marginal. Add across groups: 0+0.2=0.20+0.2=0.2.
  2. Joint cell. The group-one, mark-sixty cell is 0.20.2.
  3. Conditional. Divide by the mark-sixty marginal: 0.2/0.2=10.2/0.2=1. In this pile, every mark-sixty script belongs to group one.

2. A normalized slice

In the triangular density model, find P(X<1/4∣Y=1/2)P(X<1/4\mid Y=1/2).

Solution
  1. Conditional model. X∣Y=1/2X\mid Y=1/2 is uniform on (0,1/2)(0,1/2), with density 22.
  2. Interval area. 2(1/4)=1/22(1/4)=1/2.
  3. Distinction. This conditional-density calculation does not use P(Y=1/2)P(Y=1/2) as a denominator.

2.9 Conditional expectations

Group averages, weights and iterated expectation

2.9.1Average a distribution after conditioning

A conditional expectation is the mean of a conditional distribution. It answers a question such as: among members of this group, what is the average outcome? Keep the class notation YY for mark and XX for its group indicator.

For a fixed value xx, assuming the relevant conditional mean exists,

m(x)=E[Y∣X=x],m(x)=∑yy pY∣X(y∣x),m(x)=∫y fY∣X(y∣x) dy.\begin{aligned}m(x)&=E[Y\mid X=x],\\m(x)&=\sum_y y\,p_{Y\mid X}(y\mid x),\\m(x)&=\int y\,f_{Y\mid X}(y\mid x)\,dy.\end{aligned}

The second line is the discrete case and the third the density case. First restrict and normalize the distribution, then average it. The weights must sum to one within the chosen group.

The distinction between m(x)m(x) and m(X)m(X) is useful. At a particular known group, its mean is a number. Before we know which group a selected student belongs to, the conditional mean is itself a variable: it takes the appropriate group mean when XX is realized. It predicts a group average, not every individual’s exact mark.

Conditional means are central to regression and comparisons between groups. For an income variable YY, a difference between means conditional on a recorded gender indicator describes an average earnings gap. It does not by itself measure what changing gender would cause, because the groups can differ in other relevant features. Causal interpretation requires the assumptions developed in the causal topic.

2.9.2Group means retain the original students

The four group-one marks are 60,60,80,9060,60,80,90. The six group-zero marks are 30,30,30,80,80,10030,30,30,80,80,100. Their conditional means are

The group totals are 290290 and 350350, respectively. Dividing each by its own number of students gives

E[Y∣X=1]=290/4=72.5,E[Y∣X=0]=350/6=1753≈58.3333.\begin{aligned}E[Y\mid X=1]&=290/4=72.5,\\E[Y\mid X=0]&=350/6\\&=\frac{175}{3}\approx58.3333.\end{aligned}

Equivalently, the conditional probabilities within group one are 1/21/2 at 6060, 1/41/4 at 8080, and 1/41/4 at 9090. Their weighted average is again 72.572.5. The between-group mean difference is 72.5−175/3=85/6≈14.166772.5-175/3=85/6\approx14.1667, an association in these records.

The unweighted mean of the two group means is approximately 65.416765.4167, not the overall mean 6464. Giving each group equal weight would describe a population split equally between the groups, whereas the actual class shares are 0.40.4 and 0.60.6. Each student should have equal weight in a uniform draw from the class, not each group.

2.9.3The law of iterated expectation

Law of iterated expectation. For an integrable YY,

E[Y]=E[E[Y∣X]].E[Y]=E[E[Y\mid X]].

Average within each group, then average the group means using their probabilities. The outer expectation averages over XX; the inner expectation averages over YY conditional on that XX.

  1. Conditional mean. Define m(x)=∑yy pY∣X(y∣x)m(x)=\sum_y y\,p_{Y\mid X}(y\mid x).
  2. Weight by group probability. Average m(x)m(x) over the distribution of XX.
  3. Restore joint weights. Multiplication by pX(x)p_X(x) turns each conditional mass into pX,Y(x,y)p_{X,Y}(x,y).
  4. Marginalize. Sum those joint masses over xx to recover the marginal distribution of YY.
E[m(X)]=∑xm(x)pX(x)=∑x∑yy pX,Y(x,y)=∑yy pY(y)=E[Y].\begin{aligned}E[m(X)]&=\sum_xm(x)p_X(x)\\&=\sum_x\sum_y y\,p_{X,Y}(x,y)\\&=\sum_y y\,p_Y(y)\\&=E[Y].\end{aligned}

For the class this gives, without rounding the group mean prematurely,

E[Y]=0.4(72.5)+0.6(175/3)=29+35=64.\begin{aligned}E[Y]&=0.4(72.5)+0.6(175/3)\\&=29+35=64.\end{aligned}
Before playing, predict: the two group means are 72.572.5 and 58.33.58.33\text{.} Is the class mean their simple average, 65.4265.42?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. Ten students, one dot each. The class mean is E[Y]=640/10=64.E[Y]=640/10=64\text{.}
  2. Split the class by XX and average within each group: E[Y∣X=1]=290/4=72.5E[Y\mid X=1]=290/4=72.5 and E[Y∣X=0]=350/6≈58.33.E[Y\mid X=0]=350/6\approx58.33\text{.}
  3. Replace each mark by its group mean. This is E[Y∣X]:E[Y\mid X]\text{:} 72.572.5 for 44 of the 1010 students and 58.3358.33 for the other 6,6\text{,} so the weights are 0.40.4 and 0.6.0.6\text{.}
  4. Average with those weights: 0.4(72.5)+0.6(175/3)=29+35=64=E[Y].0.4(72.5)+0.6(175/3)=29+35=64=E[Y]\text{.} The simple average 65.4265.42 would weight the groups equally, as if the class were split half and half.

The same logic works with densities and integrals. Zero-probability groups contribute no joint mass; elementary conditional ratios need only be formed for positive-probability groups.

2.9.4What can be treated as known?

When conditioning on XX, any function of XX is known within that condition. For suitable integrable quantities,

E[h(X)Y∣X]=h(X)E[Y∣X].E[h(X)Y\mid X]=h(X)E[Y\mid X].

At X=xX=x, the multiplier h(x)h(x) is fixed, so it comes outside the conditional average just as a constant comes outside an ordinary expectation. This does not permit pulling an unknown function of YY outside an expectation conditioned only on XX.

If XX and YY are independent, the conditional distribution of YY does not change with XX, so E[Y∣X]=E[Y]E[Y\mid X]=E[Y]. The reverse implication is weaker: an unchanged conditional mean does not establish an unchanged whole distribution. Conditional variance or other features might still vary. The next chapter distinguishes full independence, mean-independence and zero covariance.

In the triangular density model, X∣Y=yX\mid Y=y was uniform from zero to yy. Its conditional mean is therefore y/2y/2. This is a continuous conditional-mean function: a larger value of the conditioning variable changes the expected value of the other measurement. The function can be meaningful even though each exact conditioning point has zero probability in an unconditional continuous model.

2.9.5Restore the population weights

1. A hypothetical mixture

Hold the two class group distributions fixed but give group one population share 0.70.7. What is the mixture mean?

Solution
  1. Weights. The other group has share 0.30.3.
  2. Iteration. E[Y]=0.7(72.5)+0.3(175/3)=50.75+17.5=68.25E[Y]=0.7(72.5)+0.3(175/3)=50.75+17.5=68.25.
  3. Interpretation. The mixture changes because group proportions change. The original class remains a different distribution with mean 6464.

2. Pull out what is known

In the original class, find E[XY∣X=0]E[XY\mid X=0], E[XY∣X=1]E[XY\mid X=1], and E[XY]E[XY].

Solution
  1. Condition zero. XX is zero, so the product and its conditional mean are zero.
  2. Condition one. XX is one, so E[XY∣X=1]=E[Y∣X=1]=72.5E[XY\mid X=1]=E[Y\mid X=1]=72.5.
  3. Average across groups. E[XY]=0.6(0)+0.4(72.5)=29E[XY]=0.6(0)+0.4(72.5)=29.

2.10 Covariance, correlation and independence

Separate linear association from probabilistic dependence

2.10.1Measure whether deviations move together

Variance squares one variable’s deviation. Covariance multiplies deviations of two variables measured together. Assume finite second moments, and write their means as μX=E[X]\mu_X=E[X] and μY=E[Y]\mu_Y=E[Y].

Definition.

Cov⁡(X,Y)=E[(X−μX)(Y−μY)].\begin{gathered}\operatorname{Cov}(X,Y)\\=E[(X-\mu_X)(Y-\mu_Y)].\end{gathered}

If both deviations have the same sign, their product is positive. If one is above its mean while the other is below, their product is negative. Covariance averages these signed products using the joint distribution. A positive result indicates a tendency for above-average values to occur together; a negative result indicates an opposite tendency. It does not assert that every pair follows that pattern.

Products of deviations determine the sign

Four sign quadrants for deviations from two means
(+)(+)>0(+)(+)>0
(−)(−)>0(-)(-)>0
(−)(+)<0(-)(+)<0
(+)(−)<0(+)(-)<0
X−μXX-\mu_X
Y−μYY-\mu_Y
Pairs in the upper-right and lower-left contribute positively; pairs in the other two quadrants contribute negatively. Covariance is the weighted average of these products, including their magnitudes.
  1. Expand. The product is XY−μXY−μYX+μXμYXY-\mu_XY-\mu_YX+\mu_X\mu_Y.
  2. Average. Apply linearity and substitute both means.
  3. Cancel constants. This gives
Cov⁡(X,Y)=E[XY]−E[X]E[Y].\begin{gathered}\operatorname{Cov}(X,Y)\\=E[XY]-E[X]E[Y].\end{gathered}

Covariance is often denoted σXY\sigma_{XY}, read “sigma sub X Y.” Its units are the product of the two measurement units, so changing units changes its numerical magnitude. Setting X=YX=Y recovers Var⁡(X)\operatorname{Var}(X).

For the class, retain XX as the binary group indicator and YY as mark. We found E[X]=0.4E[X]=0.4, E[Y]=64E[Y]=64, and E[XY]=29E[XY]=29. Thus Cov⁡(X,Y)=29−0.4(64)=3.4\operatorname{Cov}(X,Y)=29-0.4(64)=3.4. The positive covariance reflects the higher mean mark in group one; it is descriptive rather than a causal effect.

2.10.2Covariance rules and the spread of sums

Covariance is symmetric, unchanged by adding constants to either variable, and linear in each argument separately. For constants a,b,c,da,b,c,d,

Cov⁡(X,Y)=Cov⁡(Y,X),Cov⁡(X,c)=0,Cov⁡(a+bX,c+dY)=bd Cov⁡(X,Y).\begin{gathered}\operatorname{Cov}(X,Y)=\operatorname{Cov}(Y,X),\\\operatorname{Cov}(X,c)=0,\\\operatorname{Cov}(a+bX,c+dY)\\=bd\,\operatorname{Cov}(X,Y).\end{gathered}

It also distributes across addition: Cov⁡(X,Y+Z)=Cov⁡(X,Y)+Cov⁡(X,Z)\operatorname{Cov}(X,Y+Z)=\operatorname{Cov}(X,Y)+\operatorname{Cov}(X,Z). These properties are called bilinearity. They follow by centring the variables, pulling constants outside expectations, and separating sums.

To calculate the variance of a sum, square its combined deviation:

[(X−μX)+(Y−μY)]2=(X−μX)2+(Y−μY)2+2(X−μX)(Y−μY).\begin{aligned}&[(X-\mu_X)+(Y-\mu_Y)]^2\\&\quad=(X-\mu_X)^2+(Y-\mu_Y)^2\\&\qquad+2(X-\mu_X)(Y-\mu_Y).\end{aligned}

Averaging gives the variance rule:

Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y),Var⁡(X−Y)=Var⁡(X)+Var⁡(Y)−2Cov⁡(X,Y).\begin{aligned}\operatorname{Var}(X+Y)&=\operatorname{Var}(X)+\operatorname{Var}(Y)\\&\quad+2\operatorname{Cov}(X,Y),\\\operatorname{Var}(X-Y)&=\operatorname{Var}(X)+\operatorname{Var}(Y)\\&\quad-2\operatorname{Cov}(X,Y).\end{aligned}

More generally,

Var⁡(aX+bY)=a2Var⁡(X)+b2Var⁡(Y)+2abCov⁡(X,Y).\begin{aligned}&\operatorname{Var}(aX+bY)\\&\quad=a^2\operatorname{Var}(X)\\&\qquad+b^2\operatorname{Var}(Y)\\&\qquad+2ab\operatorname{Cov}(X,Y).\end{aligned}

The formula with subtraction follows by replacing bb with −b-b. Positive covariance increases the spread of a sum but reduces the spread of a difference. Dropping the covariance terms requires a justification. Independence is sufficient; zero covariance is sufficient for this variance calculation even when the variables are dependent.

2.10.3Correlation removes the units

When both standard deviations are positive, define correlation by

ρXY=Corr⁡(X,Y)=Cov⁡(X,Y)σXσY.\begin{aligned}\rho_{XY}&=\operatorname{Corr}(X,Y)\\&=\frac{\operatorname{Cov}(X,Y)}{\sigma_X\sigma_Y}.\end{aligned}

It is the covariance of the standardized variables. Removing their units lets the same measure compare relationships expressed on different positive scales. In the class, Var⁡(X)=0.4(0.6)=0.24\operatorname{Var}(X)=0.4(0.6)=0.24 and Var⁡(Y)=624\operatorname{Var}(Y)=624, so

ρXY=3.40.24624≈0.27783.\begin{aligned}\rho_{XY}&=\frac{3.4}{\sqrt{0.24}\sqrt{624}}\\&\approx0.27783.\end{aligned}

Correlation lies between −1-1 and 11. To see why, let ZX,ZYZ_X,Z_Y be the standardized variables. Their variances are one, so nonnegativity of Var⁡(ZX−ZY)=2−2ρ\operatorname{Var}(Z_X-Z_Y)=2-2\rho gives ρ≤1\rho\leq1, and nonnegativity of Var⁡(ZX+ZY)=2+2ρ\operatorname{Var}(Z_X+Z_Y)=2+2\rho gives ρ≥−1\rho\geq-1. Equality describes an exact linear relationship with probability one. Positive changes of units preserve correlation; reversing one variable’s sign reverses its sign.

If either variable has zero variance, covariance is zero but correlation is undefined because its denominator is zero. It should not be reported as zero correlation. Correlation summarizes linear association; zero correlation does not establish the absence of every relationship.

2.10.4Independence, mean-independence and zero covariance

Full independence means learning one variable does not change the other’s whole distribution. With the required finite moments, independence implies E[XY]=E[X]E[Y]E[XY]=E[X]E[Y], hence zero covariance and, when both variances are positive, zero correlation. The reverse implications need not hold.

A concrete hypothetical model exposes the distinction. Let XX take −1,0,1-1,0,1 with equal probabilities and define Y=X2Y=X^2. Then

E[X]=0,E[Y]=2/3,E[XY]=(−1+0+1)/3=0,Cov⁡(X,Y)=0.\begin{gathered}E[X]=0,\qquad E[Y]=2/3,\\E[XY]=(-1+0+1)/3=0,\\\operatorname{Cov}(X,Y)=0.\end{gathered}

The correlation is also zero because both variances are positive. Nevertheless, YY is completely determined by XX. For example P(Y=0∣X=0)=1P(Y=0\mid X=0)=1, whereas P(Y=0)=1/3P(Y=0)=1/3. The positive and negative contributions to covariance cancel; the relationship has not disappeared.

Mean-independence asks only whether a conditional mean changes. YY is mean-independent of XX when E[Y∣X]=E[Y]E[Y\mid X]=E[Y]. XX is mean-independent of YY when E[X∣Y]=E[X]E[X\mid Y]=E[X]. These are different directional conditions; one need not imply the other.

In the quadratic example, E[X∣Y=0]=0E[X\mid Y=0]=0, and at Y=1Y=1 the values −1-1 and 11 are equally likely, giving E[X∣Y=1]=0E[X\mid Y=1]=0. Thus XX is mean-independent of YY. But E[Y∣X]=X2E[Y\mid X]=X^2 varies, so YY is not mean-independent of XX. Full independence would imply both directions.

Mean-independence implies zero covariance under the relevant moment conditions: if E[Y∣X]=E[Y]E[Y\mid X]=E[Y], then iteration and pulling out the known XX give E[XY]=E[X E[Y∣X]]=E[X]E[Y]E[XY]=E[X\,E[Y\mid X]]=E[X]E[Y]. Zero covariance alone does not imply this conditional-mean equality. For example, take equal probabilities on X=−2,−1,1,2X=-2,-1,1,2 and set Y=X4Y=X^4. Symmetry gives E[X]=0E[X]=0 and E[XY]=E[X5]=0E[XY]=E[X^5]=0, so covariance is zero. Yet E[Y∣X]=X4E[Y\mid X]=X^4 changes with XX. For either Y=1Y=1 or Y=16Y=16, XX has equally likely opposite signs, so E[X∣Y]=0=E[X]E[X\mid Y]=0=E[X]. Only the reverse directional mean-independence holds.

These distinctions describe progressively weaker aspects of a joint distribution. None supplies a causal interpretation by itself. The appropriate notion depends on the question: calculating a sum’s variance, predicting a conditional mean, and asserting full probabilistic independence require different evidence.

2.10.5State the needed condition

1. Covariance changes a sum

Suppose Var⁡(X)=4\operatorname{Var}(X)=4, Var⁡(Y)=9\operatorname{Var}(Y)=9, and Cov⁡(X,Y)=3\operatorname{Cov}(X,Y)=3. Find Var⁡(X+Y)\operatorname{Var}(X+Y), Var⁡(X−Y)\operatorname{Var}(X-Y), and correlation.

Solution
  1. Sum. 4+9+2(3)=194+9+2(3)=19.
  2. Difference. 4+9−2(3)=74+9-2(3)=7.
  3. Standardize covariance. ρ=3/(49)=1/2\rho=3/(\sqrt4\sqrt9)=1/2. Both standard deviations are positive, so the ratio is defined.

2. A constant variable

If X=5X=5 with probability one and YY has finite positive variance, what are covariance and correlation? Is XX independent of YY?

Solution
  1. Centre the constant. X−E[X]=0X-E[X]=0, giving covariance zero.
  2. Correlation. It is undefined because σX=0\sigma_X=0.
  3. Independence. A constant variable is independent of every other variable: knowing it supplies no uncertain measurement information. This does not repair the zero denominator in correlation.

3. Uncorrelated does not mean unrelated

For the equal-probability quadratic model X∈{−1,0,1}X\in\{-1,0,1\}, Y=X2Y=X^2, find both variances and explain why zero covariance does not prove independence.

Solution
  1. Variance of XX. E[X2]=2/3E[X^2]=2/3 and its mean is zero, so variance is 2/32/3.
  2. Variance of YY. Y2=YY^2=Y, giving 2/3−(2/3)2=2/92/3-(2/3)^2=2/9.
  3. Conditional distribution. X=0X=0 forces Y=0Y=0, while its marginal probability is only 1/31/3. Independence fails despite zero covariance and correlation.