Salta al contenuto
Note per Studenti Discrete Random Variables Report

Discrete Random Variables

In questa pagina 4

Random variables are a powerful tool to model uncertainty. The packaging is different, but everything is based on the concept of probability space, which remains the main building block.

There are often situations where one finds it convenient to summarise, in numerical form, the information contained in a complex sample space Ω\Omega.

Example. Let the sample space Ω\Omega contain as elementary outcomes the health records of all the patients of the General Hospital. So ωi∈Ω\omega_i \in \Omega refers to patient ii and contains e.g. ωi=(namei,heighti,weighti,agei,… ).\omega_i = (\text{name}_i, \text{height}_i, \text{weight}_i, \text{age}_i, \dots). Suppose that for a certain study we are interested only in the age of the hospital patients. Then it is natural to simplify the model by extracting from Ω\Omega only the relevant information. This can be done by introducing a map A:Ω→N,ωi↦A(ωi)≜π4(ωi),A : \Omega \to \mathbb{N}, \qquad \omega_i \mapsto A(\omega_i) \triangleq \pi_4(\omega_i), where π4\pi_4 is the projection of ω\omega onto its fourth component, containing the age of patient ii.

Definition

Definition. Let (Ω,F,P)(\Omega, \mathcal{F}, P) be a probability space and X:Ω→RX : \Omega \to \mathbb{R}, ω↦X(ω)\omega \mapsto X(\omega), be a map such that

  • (i) X(Ω)={X(ω), ω∈Ω}⊂RX(\Omega) = \{X(\omega),\ \omega \in \Omega\} \subset \mathbb{R} (the image space of XX) is a discrete set, i.e. ∣X(Ω)∣≤∣N∣|X(\Omega)| \le |\mathbb{N}|. The discrete set X(Ω)X(\Omega) is called the alphabet of X(⋅)X(\cdot), often denoted X\mathcal{X}.
  • (ii) X−1({x})={ω∈Ω:X(ω)=x}∈FX^{-1}(\{x\}) = \{\omega \in \Omega : X(\omega) = x\} \in \mathcal{F} for all x∈Xx \in \mathcal{X}. Assumption (ii) is called measurability; it guarantees that one can assign the probability PP to all the possible sets X−1({x})X^{-1}(\{x\}), x∈Xx \in \mathcal{X}.

A map XX satisfying (i) and (ii) is called a discrete random variable (r.v.).

Remark. If (Ω,F,P)(\Omega, \mathcal{F}, P) is a discrete probability space where F=P(Ω)\mathcal{F} = \mathcal{P}(\Omega) (all subsets of Ω\Omega), then any function X:Ω→RX : \Omega \to \mathbb{R} with X=X(Ω)\mathcal{X} = X(\Omega) discrete is a discrete random variable, since (ii) is automatically satisfied.

Examples of random variables

Let Ω={0,1}n={ω=(b1,b2,…,bn), bi∈{0,1}}\Omega = \{0,1\}^n = \{\omega = (b_1, b_2, \dots, b_n),\ b_i \in \{0,1\}\} and let Xk:Ω→R,ω=(b1,…,bn)↦Xk(ω)=bkX_k : \Omega \to \mathbb{R}, \qquad \omega = (b_1,\dots,b_n) \mapsto X_k(\omega) = b_k (the outcome of the kk-th toss). The XkX_k, k=1,…,nk = 1,\dots,n, are nn discrete random variables: they satisfy (i) because the image space of all of them is the finite set {0,1}\{0,1\} (binary alphabet), and (ii) is trivially satisfied since F=P(Ω)\mathcal{F} = \mathcal{P}(\Omega) for discrete probability spaces.

One can operate on r.v.'s as with functions. For example, in terms of the XkX_k one can define the r.v. X:Ω→R,ω↦X(ω)=∑k=1nXk(ω),X : \Omega \to \mathbb{R}, \qquad \omega \mapsto X(\omega) = \sum_{k=1}^n X_k(\omega), and clearly X(Ω)={0,1,2,…,n}X(\Omega) = \{0, 1, 2, \dots, n\}, therefore XX too is a discrete random variable (it counts the number of 1s).

More examples. Let Ω={1,2,3,4}2={(d1,d2), di∈{1,2,3,4}, i=1,2}\Omega = \{1,2,3,4\}^2 = \{(d_1, d_2),\ d_i \in \{1,2,3,4\},\ i = 1,2\} be the sample space of two tetrahedral dice. Some r.v.'s that can be defined on Ω\Omega are Z1(ω)=d1,Z2(ω)=d2,W=max⁡(Z1,Z2),V=min⁡(Z1,Z2).Z_1(\omega) = d_1, \quad Z_2(\omega) = d_2, \quad W = \max(Z_1, Z_2), \quad V = \min(Z_1, Z_2).

Remarks on the terminology

Compare the terminology used in analysis and in probability.

  • In analysis, f:R→Rf : \mathbb{R}\to\mathbb{R}, x↦f(x)x \mapsto f(x): ff is the name of the function, xx is the name of the variable.
  • In probability, X:Ω→RX : \Omega\to\mathbb{R}, ω↦X(ω)\omega\mapsto X(\omega): XX is the name of the function.

XX is called "random variable", which is extremely misleading. First of all XX is a function, not a variable. Moreover there is nothing random about XX, which is a deterministic map. The randomness is all in ω∈Ω\omega \in \Omega: the values X(ω)X(\omega) are random, not the map.

The induced measure on the alphabet

Problem: how to construct a measure on X\mathcal{X}. The r.v. XX maps points of (Ω,F,P)(\Omega, \mathcal{F}, P) to the points x1,x2,x3,…x_1, x_2, x_3, \dots of the alphabet X⊂R\mathcal{X} \subset \mathbb{R}, and X−1({xi})X^{-1}(\{x_i\}) is the set of all outcomes sent to xix_i.

Since X\mathcal{X} is discrete, to assign a probability on it it is enough to assign it to each elementary event {xi}⊂X\{x_i\} \subset \mathcal{X}. A most natural measure on X\mathcal{X} is the induced measure PXP^X defined as PX({xi})≜P(X−1({xi})),i=1,2,…P^X(\{x_i\}) \triangleq P\big(X^{-1}(\{x_i\})\big), \qquad i = 1, 2, \dots

Discussion. Recall that X−1({xi})={ω∈Ω:X(ω)=xi}X^{-1}(\{x_i\}) = \{\omega \in \Omega : X(\omega) = x_i\}. Since XX is a function, X−1({xi})∩X−1({xj})=∅for i≠j,X^{-1}(\{x_i\}) \cap X^{-1}(\{x_j\}) = \varnothing \quad \text{for } i \ne j, and moreover ⋃iX−1({xi})=Ω\bigcup_i X^{-1}(\{x_i\}) = \Omega. Therefore the sets X−1({xi})X^{-1}(\{x_i\}), i=1,2,…i = 1,2,\dots, form a partition of Ω\Omega. The induced measure PXP^X transfers the probability measure from Ω\Omega into X\mathcal{X} in the natural way.

Notation. There are several equivalent ways of denoting the induced measure, used depending on convenience: PX({xi})≜P(X−1({xi}))=P({ω:X(ω)=xi})=P([X=xi])=P(X=xi),P^X(\{x_i\}) \triangleq P\big(X^{-1}(\{x_i\})\big) = P(\{\omega : X(\omega) = x_i\}) = P([X = x_i]) = P(X = x_i), where PXP^X is the measure on X\mathcal{X} and PP the measure on Ω\Omega.

Lemma. PXP^X is a probability measure.

Proof. (i) PX({xi})≥0P^X(\{x_i\}) \ge 0 for all ii. (ii) Using the partition property, ∑xk∈XPX({xk})=∑xk∈XP({ω:X(ω)=xk})=P(⋃xk∈X{ω:X(ω)=xk})=P(Ω)=1.\sum_{x_k \in \mathcal{X}} P^X(\{x_k\}) = \sum_{x_k\in\mathcal{X}} P(\{\omega : X(\omega) = x_k\}) = P\Big(\bigcup_{x_k \in \mathcal{X}} \{\omega : X(\omega) = x_k\}\Big) = P(\Omega) = 1. Since X={x1,x2,… }\mathcal{X} = \{x_1, x_2, \dots\} is a discrete set, PX({xi})≥0P^X(\{x_i\}) \ge 0 for all ii and ∑iPX({xi})=1\sum_i P^X(\{x_i\}) = 1, the conclusion is that PXP^X is a probability measure on X\mathcal{X}. □\square

Example. Let Ω={(d1,d2), di∈{1,2,3,4}}\Omega = \{(d_1,d_2),\ d_i \in \{1,2,3,4\}\} (two tetrahedral dice, equiprobable outcomes, 16 in total) and Z(ω)=max⁡(d1,d2)Z(\omega) = \max(d_1, d_2). In the grid of outcomes (rows: first die, columns: second die) the level sets of ZZ are the "L-shaped" regions:

   II ->   1   2   3   4
 I
 4         x   x   x   x      Z = 4  (7 outcomes)
 3         x   x   x   x      Z = 3  (5 outcomes)
 2         x   x   x   x      Z = 2  (3 outcomes)
 1         x   x   x   x      Z = 1  (1 outcome)

(outcome (d1,d2)(d_1,d_2) belongs to the L-shaped region Z−1({m})Z^{-1}(\{m\}) with m=max⁡(d1,d2)m = \max(d_1,d_2).) Counting outcomes: PZ({4})=P(Z=4)=716,PZ({3})=516,PZ({2})=316,PZ({1})=116,P^Z(\{4\}) = P(Z=4) = \tfrac{7}{16}, \quad P^Z(\{3\}) = \tfrac{5}{16}, \quad P^Z(\{2\}) = \tfrac{3}{16}, \quad P^Z(\{1\}) = \tfrac{1}{16}, which add up to 11 (checked on the page).

Discrete probability density

When random variables are used as models of random phenomena they are almost never specified as functions X:Ω→RX: \Omega\to\mathbb{R}, i.e. neither the sample space Ω\Omega on which they are defined nor the functional form of XX are explicitly given. What is given is the set of its possible values, i.e. the alphabet X\mathcal{X}, and the measure on X\mathcal{X} in the form of a discrete density.

Definition. Let X:Ω→RX : \Omega \to \mathbb{R} be a discrete random variable with alphabet X\mathcal{X}. The map pX:X→R,xk↦pX(xk)≜PX({xk})=P({ω:X(ω)=xk})=P(X=xk)p_X : \mathcal{X} \to \mathbb{R}, \qquad x_k \mapsto p_X(x_k) \triangleq P^X(\{x_k\}) = P(\{\omega : X(\omega) = x_k\}) = P(X = x_k) is called the discrete density of the r.v. XX.

Warning. The discrete density pXp_X is known only as the set of non-negative real numbers pX(x1),pX(x2),…p_X(x_1), p_X(x_2), \dots that add up to 1. In general the connection to the original Ω\Omega through the relation pX(xk)=P(X=xk)p_X(x_k) = P(X = x_k) is not available.

Properties of the discrete density pXp_X:

  • (i) pX(xk)≥0p_X(x_k) \ge 0 for all xk∈Xx_k \in \mathcal{X};
  • (ii) ∑xk∈XpX(xk)=1\sum_{x_k \in \mathcal{X}} p_X(x_k) = 1;
  • (iii) PX(B)=∑xk∈BpX(xk)P^X(B) = \sum_{x_k \in B} p_X(x_k) for all B⊂XB \subset \mathcal{X}.

Critical example: random variables with identical densities

Let Ω={0,1}2={00,01,10,11}\Omega = \{0,1\}^2 = \{00, 01, 10, 11\} and let PpP_p be the (binomial) measure on Ω\Omega with p∈[0,1]p \in [0,1], p≠12p \ne \frac12. Then Pp(00)=(1−p)2,Pp(01)=Pp(10)=p(1−p),Pp(11)=p2.P_p(00) = (1-p)^2, \quad P_p(01) = P_p(10) = p(1-p), \quad P_p(11) = p^2. Consider the random variables X1((b1,b2))=b1 (the first bit),X2((b1,b2))=b2 (the second bit).X_1((b_1,b_2)) = b_1 \ \text{(the first bit)}, \qquad X_2((b_1,b_2)) = b_2 \ \text{(the second bit)}. X1X_1 sends {10,11}\{10, 11\} to 11 and {00,01}\{00, 01\} to 00; X2X_2 sends {01,11}\{01, 11\} to 11 and {00,10}\{00, 10\} to 00. Clearly pX1(1)=PX1({10,11})=p(1−p)+p2=p,pX1(0)=1−p,p_{X_1}(1) = P^{X_1}(\{10, 11\}) = p(1-p) + p^2 = p, \qquad p_{X_1}(0) = 1-p, pX2(1)=PX2({01,11})=(1−p)p+p2=p,pX2(0)=1−p.p_{X_2}(1) = P^{X_2}(\{01, 11\}) = (1-p)p + p^2 = p, \qquad p_{X_2}(0) = 1-p. X1X_1 and X2X_2 are different r.v.'s ω\omega by ω\omega (as functions) but share a common density. The density does not specify the r.v. as a function!

See Distribution FunctionThe distribution function F_X(x) = P(X <= x) is an alternative to the discrete density; for a discrete random variable it is a right-continuous non-decreasing step function whose jumps are the values of the density.Distribution Function → for the alternative description of a r.v., Bernoulli, Uniform and Binomial Random VariablesBernoulli, discrete uniform and binomial random variables are the basic families with finite alphabet; the binomial counts successes in n independent identical trials, and when independence or constant probability fails (urns without replacement) the hypergeometric density appears instead.Bernoulli, Uniform and Binomial Random Variables → for the main finite-alphabet examples, and Functions of Random Variables and LOTUSA function g(X) of a discrete random variable is again a discrete random variable whose density is obtained by summing p_X over the preimage, and the LOTUS computes E(g(X)) directly from p_X without finding the density of g(X).Functions of Random Variables and LOTUS → for operating on r.v.'s.

Versione ripasso

Definition. On (Ω,F,P)(\Omega,\mathcal{F},P), X:Ω→RX:\Omega\to\mathbb{R} is a discrete r.v. if (i) its image X=X(Ω)\mathcal{X}=X(\Omega) (the alphabet) is a discrete set and (ii) X−1({x})∈FX^{-1}(\{x\})\in\mathcal{F} for all x∈Xx\in\mathcal{X} (measurability). If F=P(Ω)\mathcal{F}=\mathcal{P}(\Omega), (ii) is automatic.

XX is a deterministic function; the randomness is in ω\omega. Operations on r.v.'s are operations on functions (e.g. X=∑kXkX=\sum_k X_k counts the 1s in a bit string).

Induced measure. PX({xi})=P(X−1({xi}))=P(X=xi)P^X(\{x_i\})=P(X^{-1}(\{x_i\}))=P(X=x_i). The sets X−1({xi})X^{-1}(\{x_i\}) partition Ω\Omega, so PXP^X is a probability measure on X\mathcal{X} (non-negative, sum =P(Ω)=1=P(\Omega)=1).

Discrete density. pX(xk)=P(X=xk)p_X(x_k)=P(X=x_k); properties: pX≥0p_X\ge0, ∑XpX=1\sum_{\mathcal{X}}p_X=1, PX(B)=∑xk∈BpX(xk)P^X(B)=\sum_{x_k\in B}p_X(x_k).

Example: Z=max⁡(d1,d2)Z=\max(d_1,d_2) for two tetrahedral dice: pZ=116,316,516,716p_Z=\frac1{16},\frac3{16},\frac5{16},\frac7{16} for Z=1,2,3,4Z=1,2,3,4.

Typical mistake: the density does not identify the r.v. as a function. With PpP_p, p≠12p\neq\frac12, on {0,1}2\{0,1\}^2 the two bits X1,X2X_1,X_2 are different functions with the same density pX(1)=pp_X(1)=p, pX(0)=1−pp_X(0)=1-p.

Teoria collegata