2.5.1. Discrete Random Variables
A discrete random variable \(X\) maps the elementary events \(u\in U\) unto a value in \(\setZ\). i.e. \(X: u\in U \mapsto X(u)\in\setZ\). Note that the random variable \(X\) in iteself is not an event. We can specify an event \(A\), associated with outcome \(X=x\), by specifying
We will most often abbreviate this and write the event \(A\) as \(X=x\). Carefully note the distinction between capital \(X\) and \(x\). The capital \(X\) always refers to random variables and lower case letters refer to values from the range of the mapping \(X\).
A discrete variable is completely characterized in case for all \(x\in\setZ\) we specify \(\P(X=x)\). We will do this with the probability mass functions \(p_X\):
As an example consider our fair die again, there we have:
Show code for figure
1import numpy as np
2import matplotlib.pyplot as plt
3
4plt.clf()
5
6x = np.arange(-5, 12)
7p = np.zeros_like(x, dtype=float)
8p[np.logical_and(x>=1, x<=6)] = 1/6
9plt.stem(x,p)
10plt.savefig('source/figures/pmsdice.png')
Note that we assume that the events \(X=x_1\) and \(X=x_2\) are disjunct in case \(x_1\not=x_2\) and futhermore that all \(X=x\) for \(x\in\setZ\) form a partition of \(U\) and therefore:
As an example of a discrete random variable let us set a simple random experiment. We throw with two dice and count the number of both die.
It is evident that \(p_X(x)=0\) for \(x<2\) and \(x>12\). Later on in this chapter we will discuss how to calculate the probabilities for \(2\le x\le 12\). Here we will assume that we are able to simulate this random experiment by randomly generating two numbers in the range from 1 to 6 and adding these numbers. With this simulation we can estimate the probabilities based on our frequentist view on probability. The result is shown in the figure below.
Carefully note that this is only an estimate of the probability mass function. In this case it is easy to calculate the exact function (we will do that in a later section) in other situations observing a random experiment and estimating the probability mass function from the sample is needed.