0% found this document useful (0 votes)
48 views18 pages

Week-5 GA Solution 1

The document contains solutions to various statistical problems involving probability distributions and transformations of random variables. It includes calculations for the probability of selecting a specific type of battery, finding conditional probabilities, and deriving the PDFs of transformed random variables. Additionally, it covers expected values and variances for continuous random variables with given PDFs.

Uploaded by

bjoshita05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views18 pages

Week-5 GA Solution 1

The document contains solutions to various statistical problems involving probability distributions and transformations of random variables. It includes calculations for the probability of selecting a specific type of battery, finding conditional probabilities, and deriving the PDFs of transformed random variables. Additionally, it covers expected values and variances for continuous random variables with given PDFs.

Uploaded by

bjoshita05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

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
1 2 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

11. Let X ∼ Uniform[0, 1] be a continuous random variable. Define a new random variable
Y = − log(X).
(i) Find the probability density function of Y .
(a) fY (y) = e−y , for y > 0.
(b) fY (y) = 1 − e−y , for y > 0.
(c) fY (y) = 1 − ey , for y > 0.
(d) fY (y) = ey , for y > 0.
Solution:
Given, X ∼ Uniform[0, 1]
So, fX (x) = 1
We know that in the range [0, 1], − log(x) is monotonic (decreasing function).
1
Therefore, we can use the formula, fY (y) = ′ −1 fX (g −1 (y))
|g (g (y))|
Given, Y = − log(x) = g(x) (let)
=⇒ −y = log(x) =⇒ exp(−y) = exp(log(x)) =⇒ x = exp(−y) = g −1 (x)
Therefore, g −1 (x) = exp(−y)
−1
g(x) = − log(x) =⇒ g ′ (x) =
x

Page 12
And
−1
g ′ (g −1 (y)) =
exp(−y)
1
|g ′ (g −1 (y))| =
exp(−y)
fX (g −1 (y)) = fX (exp(−y)) = 1
1
Therefore, fY (y) =   = exp(−y)
1
exp(−y)
Therefore

fY (y) = exp(−y) for y > 0


(ii) Find E[Y ].

Solution :

Z ∞
E[Y ] = yfY (y)dy
Z−∞

= y × exp(−y)dy − − − − − − eq(1)
0

Z
I= y × exp(−y)dy
Z
= −y exp(−y) − − exp(−y)dy {Using Integrate by parts}
Z
= −y exp(−y) − exp(−y) + C {Since, − exp(−y) = exp(−y)}

= −(y + 1) exp(−y) + C− − − − − − eq(2)

On using (2) in (1) we get

E[Y ] = −(y + 1) exp(−y)


0
=1

Alternative method:
(
exp(−y) y ≥ 0,
fY (y) =
0 y<0

Page 13
On comparing with PDF of exponential distribution
(
λ exp(−λy) y ≥ 0,
fY (y) =
0 y<0
We get λ = 1
Therefore,
Y ∼ exp(1)

So,
1
E[Y ] = =1
λ

12. Let X be a continuous uniform random variable on [0, 100]. Define f (x) as
(
2(a − x), if x ≤ a
f (x) =
x − a, if x > a,

where a is a real number between 0 and 100. What value should you choose for a to
minimize the expected value of f (X)? Enter the answer correct to two decimal places.
Solution:
Given, X ∼ Uniform[0, 100]
1
fX (x) =
100
The expectation of a function of random variable g(X) is given by,
Z a Z 100
1 1
E[f (X)] = 2(a − x) · dx + (x − a) · dx
0 100 a 100
a 100
x2 1 x2
 
2
= ax − + − ax
100 2 0 100 2 a
2 2
a2
   
2 2 a 1 100 2
= a − + − a · 100 − +a
100 2 100 2 2
a2 1002 a2
 
1
= + − 100a +
100 100 2 2
2 2
a 100 a
= + −a+
100 2 200
3a2
= + 50 − a
200

Page 14
To minimize E[f (X)], we differentiate it with respect to a and set the derivative equal
to zero:
d 6a
E[f (X)] = −1=0
da 200
Solving for a, we get:
6a 200
= 1 =⇒ a = = 33.33
200 6
13. The probability density function of a continuous random variable X is given by
(
1
ax + 10 , 1≤x≤2
fX (x) =
0, otherwise.
(a) Find the distribution of Y = 3X + 2.

 2y − 3 , 5 ≤ x ≤ 8
(A) fY (y) = 10
0, otherwise.

 2y − 3 , 5 ≤ x ≤ 8
(B) fY (y) = 30
0, otherwise.

 2y + 3 , 1 ≤ x ≤ 2
(C) fY (y) = 30
0, otherwise.

y − 2, 5 ≤ x ≤ 8
(D) fY (y) = 3
0, otherwise.
Answer : (B)
Solution :
First of all we will find out the value of a in the above function and we know that
the integration of a pdf over the entire range is equal to 1, Therefore,
Z 2 
1
ax + =1
1 10
 2 2
x x
a + =1
2 10 1
   
2 a 1
2a + − + =1
10 2 10

3a 1
+ =1
2 10
3
a=
5

Page 15
Now, as Y = 3X + 2 is a monotonic function and differential function. Therefore,
g(x) = 3X + 2

g ′ (x) = 3

And,
Y −2
X=
3
Y −2
g −1 (y) =
3
Now putting all the values in the below formula:
1 −1
f (y) = fx (g (y))
|g ′ (g −1 (y))|
we get,
   
1 3 y−2 1
f (y) = +
3 5 3 10
 
1 y−2 1
f (y) = +
3 5 10

2y − 4 + 1
f (y) =
30
2y − 3
f (y) =
30
Hence, the distribution of Y = 3X + 2 is

 2y − 3 , 5 ≤ x ≤ 8
fY (y) = 30
0, otherwise.
(b) Find the value of E(Y ). Enter the answer up to two decimal places.

Answer : 6.65 : Range : 6.62 - 6.68


Solution :

8  
2y − 3
Z
E(Y ) = y
5 30
8
2y 2 − 3y
Z
E(Y ) =
5 30

Page 16
8
1 2y 3 3y 2

E(Y ) = −
30 3 2 5

2(8)3 3(8)2 2(5)3 3(5)2


   
1
E(Y ) = − − −
30 3 2 3 2
   
1 1024 192 250 75
E(Y ) = − − −
30 3 2 3 2
 
1 774 117
E(Y ) = −
30 3 2
 
1 1548 − 351
E(Y ) =
30 6

1197
E(Y ) =
180

E(Y ) = 6.65

14. In an university, 30% of the students enrolled in a math course are from the science
stream, while 70% are from the commerce stream. The exam scores for science stream
students follows N (55, 36), and the exam scores for commerce stream students follows
N (60, 25). If a randomly selected student scored 60 in the exam, what is the probability
that the student is from the commerce stream? Enter the answer up to two decimal
places.
Answer : 0.80 , Range : 0.76 - 0.84
Solution :
Let X represent the stream of the student.
Thus, P (X = S) = 0.30 and P (X = C) = 0.70. Also it is given that,

P (Y |X = S) ∼ N (55, 36)
P (Y |X = C) ∼ N (60, 25)
where S = Science stream, C = commerce stream

We have to find out,

pX (c)fY |X=c (60)


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

Now,

fY (y) = ΣpX (x)fY |X=x (y)

fY (y) = pX (C)fY |X=C (y) + pX (S)fY |X=S (y)

Page 17
"  2 # "  2 #
1 −1 y − 60 1 −1 y − 55
fY (y) = 0.7 × √ exp + 0.3 × √ exp
2π5 2 5 2π6 2 6

−(y − 60)2 −(y − 55)2


   
7 1
fY (y) = √ exp + √ exp
50 2π 50 20 2π 72

Now from equation (1), we get

−(60 − 60)2
 
7
√ exp
50 2π  50
P (X = C|Y = 60) = 2
−(60 − 55)2
  
7 −(60 − 60) 1
√ exp + √ exp
50 2π 50 20 2π 72

7
P (X = C|Y = 60) = 50  
7 1 −25
+ exp
50 20 72

0.14
P (X = C|Y = 60) =
0.14 + 0.035

P (X = C|Y = 60) = 0.798 ≈ 0.80

P (X = C|Y = 60) = 0.80

Page 18

You might also like