Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Statistics for Data Science - 2

Week 5 graded Assignment


Solution

1. A person randomly chooses a battery from a store which has 40 batteries of type A and
60 batteries of type B. Battery life of type A and type B batteries are exponentially
distributed with average life of 4 years and 6 years, respectively. If the chosen battery
lasts for 5 years, what is the probability that the battery is of type A?
1
(a) 5
1 + e 12
1
(b) −5
1 + e 12
−4
e 5
(c) −6
1+e 5

−6
e 5
(d) −4
1+e 5

Solution:
Define a event X as follows:
(
1 If the chosen battery is of type A
X=
0 If the chosen battery is of type B

Let Y denote the battery life of the chosen battery.


By the given information, we have
Y |X = 1 ∼ Exp( 41 ) and

Y |X = 0 ∼ Exp( 16 )

It implies that

−y
fY |X=1 (y) = 14 e 4 ; y > 0 and

−y
fY |X=0 (y) = 16 e 6 ;y > 0

Also given that


40 2
P (X = 1) = = and
100 5
60 3
P (X = 0) = =
100 5

To find: fX|Y =5 (1). Now,

fY |X=1 (5).P (X = 1)
fX|Y =5 (1) =
fY (5)

fY |X=1 (5).P (X = 1)
=
fY |X=1 (5).P (X = 1) + fY |X=0 (5).P (X = 0)

1 −5
4
e 4 . 52
= 1 −5 −5
4
e 4 . 52 + 16 e 6 . 35

1 −5
10
e4
= 1 −5
1 −5
10
e 4 + 10 e6

−5
e 4
= −5 −5
e 4+e 6

1
= 5
1 + e 12

2. Let Y = XZ + X, where X ∼ Uniform{1, 2, 3} and Z ∼ Normal(1, 4) are independent.


Find the value of fX|Y =2 (2).

3 exp( 18 )
(a)
3 exp( 18 ) + 6 + 2 exp( 29 )
3 exp( −1
8
)
(b)
3 exp( 8 ) + 6 + 2 exp( −2
−1
9
)
2 exp( −2
9
)
(c)
3 exp( 8 ) + 6 + 2 exp( −2
−1
9
)
6
(d)
3 exp( 32 ) + 6 + 2 exp( −1
−1
18
)
Solution:

Page 2
Given that X ∼ Uniform{1, 2, 3} and Z ∼ Normal(1, 4) are independent.
Y = XZ + X
It implies that
Y |X = 1 = Z + 1 ∼ Normal(2, 4)
Y |X = 2 = 2Z + 2 ∼ Normal(4, 16)
Y |X = 3 = 3Z + 3 ∼ Normal(6, 36)

Therefore,  
−(y−2)2
fY |X=1 (y) = √1 exp
2 2π 8
 
−(y−4)2
fY |X=2 (y) = √1 exp
4 2π 32
 
−(y−6)2
fY |X=3 (y) = √1 exp
6 2π 72

To find: fX|Y =2 (2).

fY |X=2 (2).fX (2)


fX|Y =2 (2) =
fY |X=2 (2).fX (2) + fY |X=1 (2).fX (1) + fY |X=3 (2).fX (3)

 
−(2−4)2
√1 exp . 13
4 2π 32
=      
−(2−4)2 −(2−2)2 −(2−6)2
√1 exp . 31 + √1 exp . 13 + √1 exp . 31
4 2π 32 2 2π 8 6 2π 72

exp −1 1

8 4
= 1 −1
 1 −2
+ 16 exp

4
exp 8
+ 2
exp(0) 9

3 exp( −1
8
)
=
3 exp( −1
8
) + 6 + 2 exp( −2
9
)

3. Let X be a continuous random variable with the following PDF:


(
3(1 − x)2 0 < x < 1
fX (x) =
0 otherwise

Define Y = (1 − X)3 . Find the PDF of the random variable Y .

a) (
1 0<y<1
fY (y) =
0 otherwise

Page 3
b) (
(1 − y)3 0<y<1
fY (y) =
0 otherwise

c) (
y3 0<y<1
fY (y) =
0 otherwise

d) (
3y 2/3 0<y<1
fY (y) =
0 otherwise

Hint:
d
Apply the monotonic, differentiable function theorem and (1 − x)3 = −3(1 − x)2
dx

Solution:
We know that in the range (0, 1), (1 − x)3 is monotonic (decreasing function).
1
Therefore, we can use the formula, fY (y) = ′ −1 fX (g −1 (y))
|g (g (y))|

Given Y = (1 − X)3 = g(X)(let)


⇒ y 1/3 = 1 − x, ⇒ x = 1 − y 1/3 = g −1 (y)
Therefore g −1 (y) = 1 − y 1/3
d
g(x) = (1 − x)3 ⇒ g ′ (x) = −3(1 − x)2 , since (1 − x)3 = −3(1 − x)2
dx

And
g ′ (g −1 (y)) = g ′ (1 − y 1/3 ) = −3(1 − (1 − y 1/3 ))2 = −3y 2/3
|g ′ (g −1 (y))| = 3y 2/3 , since y 2/3 is positive in the range (0, 1).
fX (g −1 (y)) = fX (1 − y 1/3 ) = 3(1 − (1 − y 1/3 ))2 = 3y 2/3
3y 2/3
Therefore, fY (y) = 2/3
3y
⇒ fY (y) = 1

Therefore
(
1 0<y<1
fY (y) =
0 otherwise

4. Let X be a continuous random variable with the following PDF:


(
x2 /81 −6 < x < 3
fX (x) =
0 otherwise

Page 4
Define Y = 13 (12 − X). Find the PDF of the random variable Y .

a) (
(12 − 3y)2 /27 −6 < y < 3
fY (y) =
0 otherwise

b) (
(12 − 3y)2 /27 3 < y < 6
fY (y) =
0 otherwise

c) (
(12 − 3y)/27 −6 < y < 3
fY (y) =
0 otherwise

d) (
(12 − 3y)/27 3 < y < 6
fY (y) =
0 otherwise

Solution:
We know that in the range (-6, 3), 13 (12 − x) is monotonic (decreasing function).
1
Therefore, we can use the formula, fY (y) = ′ −1 fX (g −1 (y))
|g (g (y))|

Given Y = 31 (12 − X) = g(X)(let)


⇒ 3y = 12 − x, ⇒ x = 12 − 3y = g −1 (y)
Therefore g −1 (y) = 12 − 3y
g(x) = 31 (12 − x) ⇒ g ′ (x) = − 13

And
g ′ (g −1 (y)) = g ′ (12 − 3y) = − 13
|g ′ (g −1 (y))| = 13
(12 − 3y)2
fX (g −1 (y)) = fX (12 − 3y) =
81
(12 − 3y)2
Therefore, fY (y) = 81
1
3
(12 − 3y)2
⇒ fY (y) =
27
When x = −6, y = 6 and x = 3, y = 3.

Page 5
Therefore

 (12 − 3y)2
3<y<6
fY (y) = 27
0 otherwise

5. Let X be a continuous random variable with the following PDF:


(
x3 (6x2 + 5x − 4) 0 < x ≤ 1
fX (x) =
0 otherwise

Find the value of E[X].


523
a)
210
23
b)
210
173
c)
210
187
d)
210
Rb 1
Hint: Use a
xn dx = n+1
(bn+1 − an+1 )
Solution:
Z ∞
E[X] = xfX (x)dx
−∞
Z 1
= x × x3 (6x2 + 5x − 4)dx
0
Z 1
= (6x6 + 5x5 − 4x4 )dx
0
1 1 1
6x7 5x6 4x5
= + −
7 6 5

0 0 0
6 5 4
= + −
7 6 5
187
=
210

6. Let X be a continuous random variable with the following PDF:



x
 0≤x≤1
fX (x) = 2 − x 1 < x ≤ 2

0 otherwise

Page 6
Define Y = 6X + 5. Find the variance of Y.

Rb 1
Use a
xn dx = n+1
(bn+1 − an+1 )

Rb Rc Rb
Also, a
xn dx = a
xn dx + c
xn dx where a < c < b.

Solution:
Var(Y ) = Var(6X + 5) = 36Var(X)
And Var(X) = E[X 2 ] − (E[X])2

Z ∞
E[X] = xfX (x)dx
−∞
Z 2
= xfX (x)dx
0
Z 1 Z 2
= xfX (x)dx + xfX (x)dx
0 1
Z 1 Z 2
= x.xdx + x(2 − x)dx
0 1
1 2 2
x3 2x2 x3
= + −
3 2 3
0 1 1
1 (23 − 13 )
= + (22 − 12 ) −
3 3
1 7
= +3−
3 3
=1

Page 7
Z ∞
2
E[X ] = x2 fX (x)dx
−∞
Z 2
= x2 fX (x)dx
Z0 1 Z 2
2
= x fX (x)dx + x2 fX (x)dx
Z0 1 Z 2 1
= x2 .xdx + x2 (2 − x)dx
0
1 2 1 2
x4 2x3 x4
= + −
4 3 4
0 1 1
1 2 1
= + (23 − 13 ) − (24 − 14 )
4 3 4
1 14 15
= + −
4 3 4
7
=
6
Therefore,
Var(X) = 76 − 1 = 16
⇒ Var(Y ) = 36 × 16 = 6

7. Suppose X ∼ Normal(3, 4). Find the PDF of Y = 2X + 9.


−(y − 15)2
1
1. fY (y) = √ e 16 , −∞<y <∞
16π
−(y − 6)2
1
2. fY (y) = √ e 32 , −∞<y <∞
32π
−(y − 15)2
1
3. fY (y) = √ e 32 , −∞<y <∞
32π
−(y − 6)2
1
4. fY (y) = √ e 16 , −∞<y <∞
16π
Solution:
We know that (2X + 9) is monotonic in R.
1 −1
Therefore, we can use the formula, fY (y) = fX (g (y))
|g ′ (g −1 (y))|
Given Y = 2X + 9 = g(X)(let)
y−9
=⇒ x = = g −1 (y)
2

Page 8
y−9
Therefore, g −1 (y) =
2
g(x) = 2x + 9 ⇒ g ′ (x) = 2

Therefore,

fX (g −1 (y))
fY (y) = ′ −1
| g (g (y)) |
 
y−9
fX
2
=  
y − 9
| g′ |
2
2
y−9

1 1 −3
√ e−  2

2 2

2 2π
=
2
1 (y − 15)2
= √ e−
4 2π 32

8. Suppose X is a continuous random variable with mean 50 and variance 16. Using Cheby-
shev inequality, find the greatest lower bound of the probability that X takes a value in
between 42 and 58.
(Enter the answer correct to two decimal places)

Solution:
Using Chebyshev inequality, we know that for any random variable X
Var(X)
P (| X − E[X] |≤ c) ≥ 1 − . . . (1)
c2

Since E[X] = 50 and Var(X) = 16, (1) will become


16
P (| X − 50 |≤ c) ≥ 1 −
c2
16
=⇒ P (50 − c < X < 50 + c) ≥ 1 − . . . (2)
c2
We have to find a lower bound on the probability P (42 < X < 58). Comparing it with
equation (2), we will get c = 8.

16 1 3
Therefore, the greatest lower bound is 1 − 2
= 1 − = = 0.75.
8 4 4

Page 9
9. A passenger train arrives punctually at a station every 20 minutes. Each morning, a
passenger walks in to the train station. Let X denote the amount of time (in minutes)
the passenger waits for the train from the time he reaches the train station. It is known
that the probability density function of X is

1, if 0 < x < 20
fX (x) = 20
0, Otherwise

Find the expected value of Y = X 3 + 22.

Solution:
The expectation of a function of random variable g(X) is given by,
Z ∞
E[g(X)] = g(x)fX (x) dx
−∞

E[Y ] = E[X 3 + 22] = E[X 3 ] + 22

Expectation of X 3 is given by
Z ∞
1
E[g(X)] = x3
dx
−∞ 20
Z 20
1
= x3 dx
0 20
 4 20
1 x
=
20 4 0
1 204
= ×
20 4
E[g(X)] = 2000

Therefore, E[Y ] = 2000 + 22 = 2022.

10. 60% of the total people in a city were male and 40% were female. The age of the males is
Normal (60, 25) and the age of the females is Normal (55, 36). If the age of a randomly
selected person is 60, what is the probability that the selected candidate is male?
9
(a)
−25
9 + 5exp( )
72
3
(b)
−25
3 + 5exp( )
72

Page 10
9
(c)
−5
9 + 5exp( )
6
3
(d)
−5
3 + exp( )
6
Solution:
Define a event X as follows:
(
1 If the person chosen is a male
X=
0 If the person chosen is a female

Let Y denote the age of the chosen person.


By the given information, we have

Y |X = 1 ∼ Normal(60, 25) and


Y |X = 0 ∼ Normal(55, 36)

It implies that

1 y − 60 2
 

− 
1

fY |X=1 (y) = √ e 2 5 ; y > 0 and
5 2π
1 y − 55 2
 

− 
1

fY |X=0 (y) = √ e 2 6 ;y > 0
6 2π

Also given that

60 3 40 2
P (X = 1) = = and P (X = 0) = =
100 5 100 5

Page 11
To find: fX|Y =60 (1). Now,

fY |X=1 (60).P (X = 1)
fX|Y =60 (1) =
fY (60)

fY |X=1 (60).P (X = 1)
=
fY |X=1 (60).P (X = 1) + fY |X=0 (60).P (X = 0)

1 60 − 60 2  
 

− 
1 3

√ e 2 5
5 2π 5
= 2
1 60 − 60   1 60 − 55 2  
  

−  − 
1 3 1 2
 
√ e 2 5 + √ e 2 6
5 2π 5 6 2π 5
 
1 3

5 2π 5  
=
1 25  
  − 
1 3 1 2

√ + √ e 2 36
5 2π 5 6 2π 5
9
=  
−25
9 + 5exp
72

Page 12

You might also like