Statistics for Data Science - 2
Week 3 Practice Assignment
Expectation and variance
5 15
1. If the expected value and variance of the Binomial random variable X are and ,
2 8
respectively, then find the value of P (X = 10).
10
3
(a)
4
10
3
(b) 10
4
10
1
(c)
4
10
1
(d) 10
4
Solution: If X ∼ Binomial(n, p), then expected value and variance of X is given by np
and np(1 − p), respectively.
Given that
5
E[X] = np = ...(1)
2
And
15
Var(X) = np(1 − p) = ..(2)
8
Putting the value of np in the equation (2) from equation (1), we get
3 1
(1 − p) = ⇒ p = .
4 4
Putting the value of p in equation (1), we get
n = 10
It implies that X ∼ Binomial 10, 14
Therefore, 10 0 10
10 1 3 1
P (X = 10) = C10 =
4 4 4
1 1
2. X and Y are two independent geometric random variables with parameters and ,
2 4
respectively. Find the value of Var(X + 2Y ).
Solution:
1−p
We know that if X ∼ Geometric(p), then Var(X) =
p2
1
1− 2
Therefore, Var(X) = 1 =2 ...(1)
4
1
1− 4
Var(Y ) = 1 = 12 ...(2)
16
Now, since X and Y are independent, we have
Var(X + 2Y ) = Var(X) + 22 Var(Y )
2 + 48 = 50
3. The number of spam messages (X) sent to a server in a day has Poisson distribution
with parameter λ = 21. Each spam message independently has a probability of p = 13
of not being detected by the spam filter. Let Y denote the number of spam messages
detected by the filter in a day. Calculate the expected value of X + Y .
solution:
X denotes the number of spam messages sent to the server in a day and
X ∼ Poisson(21)
Y denotes the number of spam messages detected by the filter in a day.
1
It is given that each spam messages independently has a probability of of not being
3
detected. It implies that
2
Y |X ∼ Binomial(X, )
3
Recall that if N ∼ Poisson(λ) and Z|N ∼ Binomial(N, p), then Z ∼ Poisson(λp).
Therefore, Y ∼ Poisson(14)
E[X] = 21 and E[Y ] = 14
⇒ E[X + Y ] = E[X] + E[Y ] = 35
4. Two random variables X and Y are jointly distributed with the joint pmf
1
fXY (x, y) = (x + y),
9
where x and y are integers in 0 ≤ x ≤ 2 and 0 ≤ y ≤ 1. Let Z = XY + Y 2 . Find the
expected value of Z.
1
(a)
3
Page 2
4
(b)
3
2
(c)
3
14
(d)
9
Solution:
E[Z] = E[XY + Y 2 ]
X
= (xy + y 2 )fXY (x, y)
0≤x≤2;0≤y≤1
1 X
= (xy + y 2 )(x + y)
9 0≤x≤2;0≤y≤1
1
= (1 + 4 + 9)
9
14
=
9
5. The distribution of a certain company’s employees’ monthly salary has mean |60000 and
standard deviation |20000. The probability that a randomly selected employee from that
company has a salary either greater than or equal to |100000 or less than or equal to
|20000 is:
1
(a) at least
4
1
(b) at most
4
1
(c) at least
2
1
(d) at most
2
Solution:
Let X denote the employees’ monthly salary.
Given that E[X] = µ = 60000 and SD= σ = 20000.
P (X ≥ 100000 or X ≤ 20000) = P (X − 60000 ≥ 40000 or X − 60000 ≤ −40000)
= P (|X − 60000| ≥ 40000)
= P (|X − µ| ≥ 2σ)
By using Chebyshev’s inequality
1
≤
4
Page 3
Hence, probability that a randomly selected employee from that company has a salary
either greater than or equal to |100000 or less than or equal to |20000 is at most 14 .
6. Two random variables X and Y are jointly distributed with the joint pmf
1
fXY (x, y) = (xy + x + y + 1),
27
where x and y are integers in 0 ≤ x ≤ 1 and 1 ≤ y ≤ 3. Find the correlation coefficient
of X and Y .
Solution:
X
E[X] = xfXY (x, y)
x∈TX ,y∈YY
1 X
= x(xy + x + y + 1)
27 x∈T ,y∈Y
X Y
1
= (4 + 6 + 8)
27
18 2
= =
27 3
X
E[Y ] = yfXY (x, y)
x∈TX ,y∈YY
1 X
= y(xy + x + y + 1)
27 x∈T ,y∈Y
X Y
1
= (2 + 6 + 12 + 4 + 12 + 24)
27
60 20
= =
27 9
X
E[XY ] = xyfXY (x, y)
x∈TX ,y∈YY
1 X
= xy(xy + x + y + 1)
27 x∈T ,y∈Y
X Y
1
= (4 + 12 + 24)
27
40
=
27
Page 4
Cov(X, Y ) = E[XY ] − E[X]E[Y ]
40 2 20
= − .
27 3 9
=0
We know that
Cov(X, Y )
Correlation coefficient = p =0
Var(X)Var(Y )
7. Let X and Y be two independent random variables such that X ∼ Binomial(4, 12 ) and
Y ∼ Uniform({1, 2, 3}). Find the value of Cov(2X + Y , X + Y 2 X).
(a) 16.67
(b) 6.67
(c) 13.37
(d) 0
Solution:
Cov(2X + Y, X + Y 2 X) = Cov(2X, X + Y 2 X) + Cov(Y, X + Y 2 X)
= Cov(2X, X) + Cov(2X, Y 2 X) + Cov(Y, X) + Cov(Y, Y 2 X)
= 2Cov(X, X) + 2Cov(X, Y 2 X) + Cov(Y, X) + Cov(Y, Y 2 X)
= 2Var(X) + 2(E[X 2 Y 2 ] − E[X]E[Y 2 X]) + (E[XY ] − E[X]E[Y ])
+ (E[XY 3 ] − E[Y ]E[Y 2 X])
Since X and Y are independent random variables, (X 2 , Y 2 ), (X, Y 2 ), (X, Y 3 ) are also
independent. It implies that
E[X 2 Y 2 ] = E[X 2 ]E[Y 2 ]
E[Y 2 X] = E[Y 2 ]E[X]
E[XY 3 ] = E[X]E[Y 3 ]
Therefore,
Cov(2X + Y, X + Y 2 X) = 2Var(X) + 2(E[X 2 ]E[Y 2 ] − E[X]2 E[Y 2 ]) + (E[XY ] − E[X]E[Y ])
+ (E[X]E[Y 3 ] − E[Y ]E[Y 2 ]E[X])
= 2Var(X) + 2(E[X 2 ]E[Y 2 ] − E[X]2 E[Y 2 ]) + E[X]E[Y 3 ] − E[Y ]E[Y 2 ]E[X]
Page 5
Now, X ∼ Binomial(4, 12 )
Therefore, E[X] = np = 2
Var(X) = np(1 − p) = 1
E[X 2 ] = Var(X) + (E[X])2 = np(1 − p) + (np)2 = 1 + 4 = 5
And Y ∼ Uniform({1, 2, 3})
E[Y ] = 31 (1 + 2 + 3) = 2
E[Y 2 ] = 31 (1 + 4 + 9) = 14
3
E[Y 3 ] = 31 (1 + 8 + 27) = 12
Therefore,
70 56 56
Cov(2X + Y, X + Y 2 X) = 2(1) + 2( − ) + 24 −
3 3 3
28
= 26 −
3
= 16.67
8. The joint distribution of two random variables X and Y is given as:
X
0 1 2
Y
2 5
-1 0
17 17
1 2
0 0
17 17
3 4
1 0
17 17
Table 3.1.P: Joint distribution of X and Y .
Find the standard deviation of the product of the two random variables. (Write your
answer correct up to two decimal points.)
Solution:
To find: SD(XY )
Page 6
X
E[XY ] = xyfXY (x, y)
x∈TX ,y∈TY
2 5 4
= −1( ) − 2( ) + 2( )
17 17 17
−4
=
17
X
E[(XY )2 ] = = x2 y 2 fXY (x, y)
x∈TX ,y∈TY
2 5 4
= 1( ) + 4( ) + 4( )
17 17 17
38
=
17
Var(XY ) = E[(XY )2 ] − [E[XY ]]2
38 16
= −
17 289
630
=
289
Therefore,
p
SD(XY ) = Var(XY )
r
630
= = 1.47
289
9. An ice-cream seller sells ice creams at three prices: |30, |40, and |50. A random cus-
tomer will buy an ice cream of |30, |40 and |50 with probabilities of 0.5, 0.3, and
0.2, respectively. If the number of customers in a day follows Poisson distribution with
λ = 60, what is the expected sales (in |) of the seller in a day?
Solution:
Let X denote the number of customers coming to the ice-cream seller in a day, then
X ∼ Poisson(60)
Let Y denote the price at which the customer buys the ice-cream, then
E[Y ] = 30(0.5) + 40(0.3) + 50(0.2) = 37
If X = x customers comes at the shop, then expected sale will be xE[Y ]
Page 7
But since X ∼ Poisson(60), on an average 60 customers come to the ice-cream seller in
a day. It means that expected sale of the day will be
60E[Y ] = 60(37) = 2220
10. An urn contains 10 balls numbered from 1 to 10. We remove six balls randomly and add
up their numbers. Let X denote the sum of the numbers of the removed balls. Find the
expected value of X.
6
P
(Hint: Suppose Xi denotes the number of the ith removed ball, then X = Xi )
i=1
Solution:
Let Xi , i = 1, 2, ...6 denote the number on the ith ball, then
P6
X= (Xi )
i=1 6
P
⇒ E[X] = E (Xi )
6 i=1
P
⇒ E[X] = E(Xi )
i=1
⇒ E[X] = 6E(Xi ) ...(1)
1 11
Now, E[Xi ] = [1 + 2 + 3 + ...10] =
10 2
Putting the value in equation (1), we get
11
E[X] = 6 × = 33
2
Page 8