Equality
Contents
3.3. Equality#
We know what it means for two numbers to be equal: they are at the same spot on the number line. Equality of random variables, however, can be of more than one kind.
3.3.1. Equal#
Two random variables
This is the usual definition of the equality of two mathematical functions. Informally, it says that when
An example will make this clear. Let
Now consider the new random variable
We write this simply as
Click to show
3.3.2. Equal in Distribution#
However, there is a sense in which the number of heads “behaves in the same way” as the number of tails. The two random variables have the same probability distribution.
The outcome space is three_tosses
:
coin = make_array('H', 'T')
three_tosses = list(product(coin, repeat=3))
three_tosses
[('H', 'H', 'H'),
('H', 'H', 'T'),
('H', 'T', 'H'),
('H', 'T', 'T'),
('T', 'H', 'H'),
('T', 'H', 'T'),
('T', 'T', 'H'),
('T', 'T', 'T')]
There are only eight outcomes, so it is easy to inspect the table and write the distributions of
dist = Table().values(np.arange(4)).probabilities(make_array(1, 3, 3, 1)/8)
dist
Value | Probability |
---|---|
0 | 0.125 |
1 | 0.375 |
2 | 0.375 |
3 | 0.125 |
We say that
In general, two random variables
That is, they have the same set of possible values and the same probabilities for all those values.
Equality in distribution is denoted as
3.3.3. Relation between the Equalities#
Equality is stronger than equality in distribution. If two random variables are the same, outcome by outcome, then they must have the same distribution because they are the same function on the outcome space.
That is, for any two random variables
But as the example of heads and tails in three tosses shows, the converse need not be true.
Quick Check
The random variables below are defined on the probability space consisting of 16 equally likely outcomes of 4 tosses of a coin:
For each of the following pairs, fill in the blank with
(i)
(ii)
(iii)
(iv)
(v)
Answer
Fill (i), (ii), (iii), and (v) with
3.3.4. Example: Two Cards Dealt from a Small Deck#
A deck contains 10 cards, labeled 1, 2, 2, 3, 3, 3, 4, 4, 4, 4. Two cards are dealt at random without replacement. Let
Question 1: Are
Answer 1: No, because for example the outcome could be
Question 2: Are
Answer 2: Let’s find the two distributions and compare. Clearly the possible values are 1, 2, 3, and 4 in each case. The distribution of
When a distribution is defined by a formula like this, you can define a function that does what the formula says:
def prob1(i):
return i/10
You can create a probability distribution object for values
as before but now with the probability_function
method.
The argument to probability_function
is the name of the function that takes
possible_i = np.arange(1, 5, 1)
dist_X1 = Table().values(possible_i).probability_function(prob1)
dist_X1
Value | Probability |
---|---|
1 | 0.1 |
2 | 0.2 |
3 | 0.3 |
4 | 0.4 |
Convince yourself that the function prob2
below returns
def prob2(i):
if i == 1:
return (9/10)*(1/9)
else:
return (i/10)*((i-1)/9) + ((10-i)/10)*(i/9)
dist_X2 = Table().values(possible_i).probability_function(prob2)
dist_X2
Value | Probability |
---|---|
1 | 0.1 |
2 | 0.2 |
3 | 0.3 |
4 | 0.4 |
The two distributions are the same! Here is yet another example of symmetry in sampling without replacement. The conclusion is
Quick Check
(i)
(ii)
Answer
Both are true. For (ii), calculate