Skip to main content

5  Random Variables and Distribution Methods

This section presents random variable definitions, cdf/pdf/pmf tools, expectations, variances, covariance, and distributional transformations used in applied theory and empirical work.

5.1 Probability Space

5.1.1 Coin toss

Tail or Head, are the “specific result” or experimental outcome that is the element of the sample space, \(S\), of all possible outcomes, \(S = \{H, T\}\), from an experiment (one coin toss).

From the experiment of two coin toss, the sample space of all possible outcomes is \(S = \{HH, HT, TH, TT\}\), and \(HH\) is a the specific result or experimental outcome from the sample space.

We can group elements of the sample space based on shared characteristics into events. For two coin toss, an event might be at least one head, \(A = \{HH, HT, TH\}\), or no heads, \(B = \{TT\}\), or exactly one head, \(C = \{HT, TH\}\), or at least one tail, \(D = \{HT, TH, TT\}\), or no tails, \(E = \{HH\}\), or exactly one tail, \(F = \{HT, TH\}\), etc. Each event is a subset of the sample space, \(A, B, C, D, E, F \subseteq S\).

5.1.2 Grades, discrete finite

Minimum education attainment is 0, and maximum is say 20 years. The sample space of all possible outcomes is \(S = \{0, 1, 2, \ldots, 20\}\), and \(0\) is a the specific result or experimental outcome from the sample space. Each grade level can be considered an event, \(A = \{0\}\), \(B = \{1\}\), \(C = \{2\}\), etc. We can also group primary grades into an event, \(D = \{1, 2, 3, 4, 5, 6\}\), or secondary grades into an event, \(E = \{7, 8, 9, 10, 11, 12\}\).

Note that we are not talking about what levels of educational attainment are observed in some dataset, we are just considering all possible grade realization given what we know about k-12 system.

5.1.3 Earnings, continuous infinite

Consider earnings, earnings can only be zero or positive, but it can take on any positive real values. The sample space of all possible levels of earnings is \(S = [0, \infty)\), and \(0\) is a the specific result or experimental outcome from the sample space. Each specific level of earnings can be considered an event, \(A = \{0\}\), \(B = \{1.01\}\), \(C = \{2\}\), etc. We can also group earnings bins into events, \(D = [0, 10000]\), or another event, \(E = [10000, 20000]\).

5.1.4 Axioms of probability

For an absolutely continuous earnings distribution, a singleton such as \(\{10000\}\) is an event with probability zero; intervals can have positive probability.

The probability axioms below are due to Kolmogorov (Kolmogorov 1950).

We can assign a probability function, \(P\), to events if the probability function with respect to the events and the sample space satisfies the axioms of probability:

  1. For every event \(A \in \mathcal{F}\), \(P(A) \geq 0\).
    • An event may have probability zero. In observed data, its relative frequency may also be zero; empirical relative frequencies are estimates, not the definition of probability.
  2. \(P(\Omega) = 1\).
    • The whole sample space is an event, and the probability measure assigns it total probability one.
  3. For any countable collection of pairwise disjoint events \(A_1, A_2, \ldots \in \mathcal{F}\), the probability of their union is the sum of their probabilities:

\[ P\left(\bigcup_{j=1}^{\infty} A_j\right) = \sum_{j=1}^{\infty} P(A_j). \]

- This says that probabilities are additive (when they are from disjoint events).
- If primary-school and secondary-school events are disjoint, the probability of being in either group is the sum of their probabilities.
- In particular, $P(A \cup B) = P(A) + P(B)$ when $A$ and $B$ are disjoint.

A probability measure is a function \(P:\mathcal{F}\to[0,1]\) satisfying these axioms.

Power set

What is this “collection of events” called? For a finite sample space such as the grade levels, one possible collection is the power set \(\mathcal{P}(S)\), the set of all subsets of \(S\), including the empty set and \(S\) itself. For example, it contains \(\emptyset\), \(\{0\}\), \(\{1\}\), and \(\{0,1\}\). We can then write:

\[ P^{\text{grades}}: \mathcal{P}(S) \rightarrow [0, 1] \]

The power set is a sigma-algebra, but not every sigma-algebra is a power set. A probability model may use a smaller sigma-algebra when only some events are included.

Borel sigma algebra

If we are dealing with nonnegative earnings, an appropriate collection of events is the Borel sigma-algebra on \([0,\infty)\), denoted \(\mathcal{B}([0,\infty))\).

The Borel sigma-algebra is generated by open sets (equivalently, open intervals) and is closed under complements and countable unions. It contains the usual intervals and many other sets, but not necessarily every subset of an uncountable sample space. A probability measure for earnings can therefore be defined as:

\[ P^{\text{earnings}}: \mathcal{B}([0, \infty)) \rightarrow [0, 1]. \]

Sigma algebra

The definition of a sigma algebra, \(\mathcal{F}\), over a sample space, \(\Omega\), includes three components:

  1. The sample space is in the sigma-algebra: \(\Omega \in \mathcal{F}\).
  2. If \(A \in \mathcal{F}\), then its complement \(A^c \in \mathcal{F}\).
  3. If \(A_1,A_2,\ldots \in \mathcal{F}\), then their countable union \(\bigcup_{j=1}^{\infty} A_j \in \mathcal{F}\).

Definition of probability space

The definition of a probability space includes three components: the sample space, the collection of events, and the mapping from the collection of events to the unit interval. These are denoted as a triplet:

\[ (\Omega, \mathcal{F}, P) \]

where \(\Omega\) is the sample space, \(\mathcal{F}\) is the collection of events, and \(P\) is the probability function. The collection of events is also called a sigma algebra, which we showed could be the power set or the Borel sigma algebra.

Kolmogorov, 1933, page 3

Kolmogorov, Andrey (1950) [1933]. Foundations of the Theory of Probability. New York, US: Chelsea Publishing Company.

Kolmogorov, 1933, page 3

5.2 Random variable

5.2.1 A function assigning real values to experiment outcomes in the sample space

The probability measure maps events in the sigma-algebra \(\mathcal{F}\) to \([0,1]\). A random variable instead maps outcomes in the sample space to the real line and must be measurable: the inverse image of every Borel set must belong to \(\mathcal{F}\).

A random variable “is a real-valued outcome: a function from the sample space \(\Omega\) to the real line \(R\)”:

\[ X: (\Omega,\mathcal{F}) \rightarrow (\mathbb{R},\mathcal{B}(\mathbb{R})) \]

Suppose the sample space is \(\Omega=\{H,T\}\). Let \(\omega\in\Omega\) denote an outcome. For example, define the random variable \(X\) by:

\[ X(\omega=H) = 1 \text{ and } X(\omega =T) = 0 \]

where we assign experiment outcome \(H\) to the value \(1\), and experiment outcome \(T\) to the value \(0\). Note that what is in the sample place are like “indexes”, there are no “variables”/values associated with them yet, it’s just a collection of name tags. It is through the random variable that we assign values to these name tags.

We can also define another random variable \(Y\) as:

\[ Y(\omega = H) = 0 \text{ and } Y(\omega = T) = 100 \]

where now 0 represents 0 dollars, and 100 represents 100 dollars that you win if the coin lands on tails.

5.2.2 Probability function and random variable

But where is the “random” part? The random variable itself does not introduce any “randomness”/probability, it just gives real values to the elements in the sample space. The randomness comes from the probability function defined over the sigma algebra of the sample space.

Suppose we have a probability function \(P\) defined over the power set of the sample space, \(\mathcal{P}(S)\), such that:

\[ P({H}) = 0.5, P({T}) = 0.5 \]

Then we can say the probability that the random variable \(Y\) takes on the value 100 is:

\[ P\left(Y^{-1}\left(\{100\}\right)\right) = P\left(\left\{ T \right\}\right) = 0.50 \]

More generally, for any Borel set \(B\subseteq\mathbb{R}\), we can write

\[ P_X(B)=P\left(X^{-1}(B)\right) =P\left(\left\{\omega\in\Omega\mid X(\omega)\in B\right\}\right). \]

5.2.3 Discrete vs continuous random variable

A discrete random variable takes at most countably many values. An absolutely continuous random variable has a density and no point masses; height and weight are often modeled this way. An uncountable set of possible values alone does not guarantee absolute continuity, and distributions can also be neither discrete nor absolutely continuous.

The support of a distribution is the set of points for which every open neighborhood has positive probability. It need not be the set of points with positive density, and individual points in the support of an absolutely continuous distribution can have probability zero.

5.3 Probability mass, density, cumulative distribution function, quantiles, and moments

5.3.1 Probability mass function (pmf)

For a discrete random variable \(X\), the probability mass function (pmf) gives the probability of each possible value:

\[ p_X(x) = P(X = x) \]

where \(p_X(x)\) is the pmf of random variable \(X\). The masses are nonnegative and sum to one over the support of \(X\).

5.3.2 Cumulative distribution function (cdf)

For a discrete or continuous random variable \(X\), the cumulative distribution function (cdf) is defined as

\[ F_X(x) = P(X \leq x) \]

where \(F_X(x)\) is the cdf of random variable \(X\).

The empirical cumulative distribution function (ECDF), constructed from observations \(X_1,\ldots,X_n\), is

\[ \widehat{F}_n(x)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}\{X_i\leq x\}. \]

For discrete data, it can be computed by:

  1. Count observations at each distinct value.
  2. Sort the values from lowest to highest.
  3. Divide the counts by \(n\) and take their cumulative sum.

5.3.3 Probability density function

If the distribution of \(X\) is absolutely continuous with respect to Lebesgue measure, it has a density \(f_X\) satisfying

\[ F_X(x)=\int_{-\infty}^{x} f_X(t)\,dt. \]

The density is nonnegative and integrates to one. Where the CDF is differentiable, its derivative equals the density (up to changes on sets of measure zero). A density value is not itself a probability; probabilities are areas under the density:

\[ P(a \leq X \leq b) = \int_{a}^{b} f_X(x) dx \]

For a fair four-sided die, \(p_X(x)=1/4\) for \(x=1,2,3,4\). One way to generate this discrete outcome is to draw \(U\sim\operatorname{Uniform}(0,1)\) and assign each of four equal-length intervals of \(U\) to one die outcome. Each interval has probability \(1/4\) under the uniform density. This construction illustrates how areas under a continuous density can produce discrete probabilities; a pmf value is not generally the height of a pdf.

5.3.4 Quantiles

For \(0<\tau<1\), a standard quantile definition is the generalized inverse of the CDF:

\[ Q_X(\tau)=\inf\{x:F_X(x)\geq\tau\}. \]

When the CDF is continuous and strictly increasing at the quantile, this definition gives \(F_X(Q_X(\tau))=\tau\). In finite samples, statistical software may implement different interpolation conventions.

5.3.5 First, second, third, and fourth moments

The \(n\)th raw moment, when it exists, is the expectation:

\[ E[X^n]. \]

For a discrete variable this expectation is a sum; for an absolutely continuous variable it is an integral against its density.

For integer \(n\geq 2\), the \(n\)th central moment, when it exists, is:

\[ E[(X-\mu)^n]. \]

where \(\mu\) is the mean of \(X\).

The first moment is the mean. If the second moment is finite, the second central moment is the variance, equal to the second raw moment minus the squared mean:

\[ Var(X) = E[X^2] - (E[X])^2 \]

If the third absolute moment is finite and \(\sigma>0\), standardized skewness is:

\[ Skewness = \frac{E[(X - \mu)^3]}{\sigma^3} \]

where \(\sigma\) is the standard deviation of \(X\). The skewness can be positive, negative, or undefined. The sign describes the direction of the standardized third central moment, but does not uniquely characterize tail lengths or symmetry. Zero skewness does not in general imply a symmetric distribution.

Kurtosis is the standardized fourth central moment:

\[ Kurtosis = \frac{E[(X - \mu)^4]}{\sigma^4} \]

The normal distribution has kurtosis 3. Excess kurtosis is kurtosis minus 3, so its excess kurtosis is zero. Kurtosis summarizes standardized fourth-moment behavior; it does not by itself imply a sharper peak or uniformly heavier tails.

5.4 Transformation of random variables

5.4.1 Mean shift

Given a random variable \(X\) with cumulative distribution function \(F_X(x)\), we can define a new random variable \(Y = g(X)\), where \(g\) is some function.

When \(g(X) = X + \delta\), the cumulative distribution function of \(Y\) is:

\[ F_Y(y) = P(Y \leq y) = P(X + \delta \leq y) = P(X \leq y - \delta) = F_X(y - \delta) \]

5.4.2 Rescaling the random variable

When \(g(X) = aX\), where \(a > 0\), the cumulative distribution function of \(Y\) is:

\[ F_Y(y) = P(Y \leq y) = P(aX \leq y) = P\left(X \leq \frac{y}{a}\right) = F_X\left(\frac{y}{a}\right) \]

5.4.3 Mean-preserving relative proportion shift

Mean preserving variance shift. Let \(Y = g(X) = \mu_x + \lambda\left( X - \mu_x\right)\), where \(\lambda > 0\) and \(\mu_x = E(X)\). In this case, a shift in \(\lambda\) changes the relative distance of all data below and above the mean by the same rate, and keeps the mean unchanged. Specifically, the mean of \(Y\) is:

\[ E(Y) = E(g(X)) = E\left(\mu_x + \lambda(X - \mu_x)\right) = \mu_x + \lambda(E(X) - \mu_x) = \mu_x \]

The cumulative distribution function of \(Y\) is:

\[ F_Y(y) = P(Y \leq y) = P\left(\mu_x + \lambda(X - \mu_x) \leq y\right) = P\left(X \leq \frac{y - \mu_x}{\lambda} + \mu_x\right) = F_X\left(\frac{y - \mu_x}{\lambda} + \mu_x\right) \]

The variance of \(Y\) is:

\[ Var(Y) = Var(g(X)) = Var\left(\mu_x + \lambda(X - \mu_x)\right) = \lambda^2 Var(X) \]