Theory Unit 4
Theory Unit 4
EXAMPLE 1 (Cont.):
f0, 1, 2g
Now we obtain the probability mass function of X .
In this case, the possible outcomes of the experiment "toss the coin
two times" are HH, HT, TH, TT (where H is get a head and T is get a
tail). The probability of each of these four possible outcomes is 14 .
Therefore, the probability mass function of X is:
f(x) 0.5
0.4
0.3
0.2
0.1
0 1 2
x
F (a ) = P (X a) = ∑u 2R ,u a
P (X = u ) = ∑u 2R ,u a
f (u )
F (b ) = P (X b) = ∑u 2R ,u b
P (X = u ) = ∑u 2R ,u b
f (u )
1.0
F(x)
0.5
-2 -1 0 1 2 3 4
x
EXAMPLE 4 (Cont.):
If the player wins, the net winnings will be 9 euros (the 10 euros that
the player wins minus the euro that the ticket cost). This situation will
occur if the number drawn matches the number that the player bought.
1 .
Since there are 100 numbers, the probability that this will occur is 100
If the player gets back the cost of the ticket, the net winnings will be 0
euros. This situation will occur if the number drawn is one of the 9
numbers with the same termination as the one the player bought, but
which do not match the number bought. The probability that this will
9 .
occur is 100
If the player loses, the net winnings will be 1 euro. This situation will
occur if the number drawn is one of the 90 numbers whose termination
does not coincide with the termination of the number bought. The
90 .
probability that this will occur is 100
This result means that if we play this lottery, for example, 1000 times,
and we call X1 , ..., X1000 the net winnings that we get in each one of
this lotteries, then the sample mean (X1 + X2 + + X1000 )/1000
will be approximately equal to 0.81; therefore, the total net winnings
X1 + X2 + + X1000 will be approximately equal to 810 euros.
STATISTICS (2024-25) UNIT 4 23 / 73
3.1. Expectation of a discrete r.v.
E (X ) = x1 f (x1 ) + + xn f (xn ) +
Suppose that we are not interested in the r.v. X but a function of the
r.v., which we will call g (X ), where g is a known function. For
example, X can be the number of cars that a car dealership will sell,
but we are interested in the earnings g (X ) the dealership will make
for X cars sold. The de…nition of expectation given above can be
applied to these situations.
If X is a discrete r.v. with possible outcomes fx1 , ..., xn g and g is
any known function, the expectation of g (X ) is the weighted
average of the possible outcomes of g (X ), where the weight of the
possible outcome g (xi ) is equal to the probability of xi . This value is
denoted by E (g (X )), and following this de…nition, we have that:
x 2 1 0 1 2
f (x ) 0.1 0.2 0.4 0.2 0.1
E (Y ) = E (g (X )) =
In the last equation we have taken into account the fact that the sum
of the probabilities is 1, that is, f (x1 ) + + f (xn ) = 1.
E (X 2 ) 6 = E (X )2
where fx1 , ..., xn g are the possible outcomes of X , and f (x1 ), ...,
f (xn ) are the corresponding probabilities. The variance of the r.v. X
is usually denoted by the Greek letter σ2 (or σ2X to emphasize which
r.v. we are referring to).
STATISTICS (2024-25) UNIT 4 36 / 73
3.3. Variance and standard deviation of a discrete r.v.
x 9.9 10.1 y 9 11 z 0 20
fX ( x ) 0.5 0.5 fY ( y ) 0.5 0.5 fZ ( z ) 0.5 0.5
E (Y ) = 9 0.5 + 11 0.5 = 10
E (Z ) = 0 0.5 + 20 0.5 = 10
Var(X )=E [(X 10)2 ]=(9.9 10)2 0.5 + (10.1 10)2 0.5=0.01
Var(Y )=E [(Y 10)2 ]=(9 10)2 0.5 + (11 10)2 0.5=1
Var(Z )=E [(Z 10)2 ]=(0 10)2 0.5 + (20 10)2 0.5=100
n
= ∑i =1 (xi2 + µ2 2xi µ)f (xi )
n n n
= ∑i =1 xi2 f (xi ) + µ2 ∑i =1 f (xi ) 2µ ∑i =1 xi f (xi )
= E (X 2 ) + µ2 1 2µ µ = E (X 2 ) µ2
Hence we only have to know E (X 2 ) and µ = E (X ) to …nd Var(X ).
STATISTICS (2024-25) UNIT 4 40 / 73
3.3. Variance and standard deviation of a discrete r.v.
x 0 1 2 3
f (x ) 0.70 0.25 0.03 0.02
Many models for discrete random variables are often used. Each of
these models has a speci…c name. In this course we will see only one,
which is the most widely used model: the binomial distribution. To
de…ne this model, we will …rst explain what a Bernoulli experiment is.
A Bernoulli experiment with parameter p, where p is a real
number between 0 and 1, is an experiment that has two possible
outcomes. We will call these two possible outcomes "success" and
"failure", where p is the probability of success and 1 p is the
probability of failure.
In a Bernoulli experiment, this p value can sometimes be determined
by observing the experiment. Other times, however, we simply assume
a speci…c value for p (in the next course will see how to analyze
whether this assumption is reasonable or not).
X Bi(n; p )
= 2p 2p 2 + 2p 2 = 2p
The variance of X is:
Var(X ) = E [(X µ )2 ] = E (X 2 ) E (X )2
= [02 (1 p )2 + 12 2p (1 p ) + 22 p2 ] (2p )2
= 2p 2p 2 + 4p 2 4p 2 = 2p 2p 2 = 2p (1 p)
Like in the previous case, the variance will be small if p is close to 0 or
close to 1.
STATISTICS (2024-25) UNIT 4 54 / 73
4. Binomial distribution
f (0) = (1 p )n
f(x)
0.3
0.2
0.1
0.0
0 1 2 3 4 5 6
x
P (X > 0) = P (X = 1) + P (X = 2) + P (X = 3) + P (X = 4)+
6
P (X = 5) + P (X = 6) = ∑i =1 f (i ) = 0.88235
We can also calculate this probability using the complementary event,
which is “no customers will buy anything”:
P (X > 0) = 1 P (X = 0) = 1 f (0) = 1 0.11765 = 0.88235
E (X ) = np
Var(X ) = np (1 p)
Note that:
The mean is directly proportional to p and to n. Additionally, the
variance of X is directly proportional to n, and it will be small is p is
close to 0 or close to 1.
These formulas generalize the formulas n = 1 and n = 2.
These formulas are useful because they save having to make
calculations on the mean and variance, provided that we know that the
r.v. X we are interested in is a r.v. with a Bi(n; p ) distribution.
STATISTICS (2024-25) UNIT 4 63 / 73
4. Binomial distribution
EXAMPLE 11 (Cont.): Since we know that X = “number of
customers who will buy something” has a Bi(6; 0.3) binomial
distribution, we can calculate any probability over X , and its most
important characteristics:
The expected number of customers that will buy something is:
E (X ) = np = 6 0.3 = 1.8 customers
The variance of the number of customers that will buy something is:
Var(X ) = np (1 p) = 6 0.3 0.7 = 1.26 customers2
P (X < x ) = P (X x 1) = F (x 1)
P (X > x ) = 1 P (X x) = 1 F (x )
P (X x) = 1 P (X < x ) = 1 F (x 1)
X Bi(3030; 0.5)
EXAMPLE 13 (Cont.):
Therefore, the probability that the …nal result is a draw is:
3030!
P (X = 1515) = 0.51515 0.51515
1515! 1515!
It is di¢ cult to compute separately each one the three factors of the
right-hand side, either with a pocket calculator or with computer
software. But it is possible to …nd this probability with computer
software that includes the binomial probability mass function (this
software computes jointly the product of the three factors). For
example, using Excel we …nd that:
Thus, it is not very likely that there is a draw, but it is not impossible:
the probability of a draw is higher than 1%.