0% found this document useful (0 votes)
20 views

Math277 Assignment1 2024 Solutions

cjhiwwwbidwcwb

Uploaded by

R Nurul QA
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)
20 views

Math277 Assignment1 2024 Solutions

cjhiwwwbidwcwb

Uploaded by

R Nurul QA
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/ 6

MATH 277: Assignment 1: Solutions

Due 11:59 pm Sunday 17 March 2024

Question 1 [5 marks]
A fair die is thrown until a 6 appears. What is the probability that it must be cast more than five times?
Solution:
Lets start determining the random variable X which is number of attempt.
Our second step is determining the success probability p = 1/6.
The third step is identifying that this distribution is a geometric distribution. So, we want to find P (X > 5),
which is equal to P (X > 5) = 1 − P (X ≤ 5).
We can identify this a geometric distribution, therefore we know
P (X = x) = (1 − p)x−1 p

Method 1.
We can apply a summation of all the values of x of interest.
P (X > 5) = 1 − P (X ≤ 5)
5
X
=1− (1 − p)x−1 p
i=1
5
X 1 1
=1− (1 − )x−1
i=1
6 6
5
1X
=1− (5/6)x−1
6 i=1
= 0.402
Method 2:
Think carefully about this situation would make you realize all we need to know is the probability of
P (X > x) = 1 − (1 − p)x+1
= 1 − (1 − (5/6)5 )
= (5/6)5
= 0.402

Method 3:
We can solve this with
p= 1/6
q = 5/6
x <- seq(1,5)
f = p*qˆ(x-1)
prob <-1-sum(f)
cdf <- pgeom(x-1,1/6)
prob2 <- 1-cdf[5]
prob

1
## [1] 0.4018776
prob2

## [1] 0.4018776
Question 2 [5 marks]
Supposed 5% of men and 0.25% of women are color-blind. A person is chosen at random, and that person is
color-blind. What is the probability this person is male? (Assume a population with only males and females
with equal numbers)
Solution:
We starting by stating events: M , F and CB=color-blind and CB= is not color-blind.
We can identify two probabilities: P (M ) = 0.5 and P (F ) = 0.5. This are complementary P (F ) + P (M ) = 1.
We know two conditional probabilities P (CB|M ) = 0.05, P (CB|W ) = 0.0025.

Using Bayes rules:

P (CB|M )P (M ) 0.05 ∗ 0.5


P (M |CB) = = = 0.9524
P (CB|M )P (M ) + P (CB|F )P (F ) 0.05 ∗ 0.5 + 0.0025 ∗ 0.5

Question 3 [5 marks]
Suppose heights of male (cm) is normally distributed as

N (µ = 180, σ 2 = 6.02 )

where the mean µ = 180 and the standard deviation σ = 6.0. Do the followings with R: 1. What proportion
of males is taller than 185cm?
1-pnorm(q=185,mean=180, sd=6.0)

## [1] 0.2023284
20.2% of the males are taller than 185 cm.
2. What proportion of heights of male is in the interval

(180 − 1.96 ∗ 6.0, 180 + 1.96 ∗ 6.0)?


pnorm(q=180+1.96*6.0,mean=180, sd=6.0)-pnorm(q=180-1.96*6.0,mean=180, sd=6.0)

## [1] 0.9500042
95% of heights of male is in the interval (180 − 1.96 ∗ 6.0, 180 + 1.96 ∗ 6.0)
3. Create a plot of probability density function (pdf) of the normal distribution.
# Make pdf plot
x <- seq(180-3*6.0, 180+3*6.0 ,0.01)
p <- dnorm(x, mean=180, sd=6.0)
plot(x,p,type="l", main="pdf of Height of male distribution")

2
pdf of Height of male distribution
0.06
0.04
p

0.02
0.00

165 170 175 180 185 190 195

x 4. Cre-
ate a plot of cdf of the normal distribution.
# Make cdf plot
q <- seq(180-3*6.0, 180+3*6.0 ,0.01)
p <- pnorm(q, mean=180, sd=6.0)
plot(q,p,type="l", main="cdf of Heights of male distribution")

cdf of Heights of male distribution


1.0
0.8
0.6
p

0.4
0.2
0.0

165 170 175 180 185 190 195

q 5.

3
Draw a random sample of size 1000 from the distribution. Plot a histogram and calculate the sample mean
and the sample variance. The sample mean and the sample variance are estimators of what values?
# take random sample of size 1000 from N(mean=180, sd=6.0)
sim <- rnorm(n=1000,mean=180, sd=6.0)
hist(sim)

Histogram of sim
300
200
Frequency

50 100
0

160 170 180 190 200

sim
mean(sim)

## [1] 179.9398
var(sim)

## [1] 35.46604
Question 4 [10 marks]
Given the pdf of fX (x) = 42x5 (1 − x) for 0 < x < 1 and transformation Y = X 3 .
a.) Find the pdf of Y . b.) Show that the pdf of Y integrates to 1.

Solution:
We start with fX (x) = 42x5 (1 − x) for 0 < x < 1 and transformation Y = X 3 .
1. Note: that y = x3 = g(x) is monotone.
2. Note: Y = (0, 1).
Based on the observations we can conclude we can use the transformation method.
Our first step is to find the inverse g −1 (y) = y 1/3 .
d −1
Second we find dy g (y) = dy d 1/3
y = 13 y −2/3 .
d −1 d −1
Since y > 0, we know that dy g (y) = dy g (y) for 0 < y < 1.

Now we plug everything is our transformation equation.

4
d −1
fY (y) = fX (g −1 (y)) g (y)
dy

1
fY (y) = fX (y 1/3 ) y −2/3
3
1
= 42y 5/3 (1 − y 1/3 ) y −2/3
3
= 14y(1 − y 1/3 )
= 14y − 144/3

b. Lets check the integral which should add up to 1.


Z 1 1
3 · 14 7/3
(14y − 14y 4/3 )dy = 7y 2 − y =7−6=1
0 7 0

Question 5 [10 marks]


2.Given the cdf of 
0 if x < 0
FX (x) =
1 − e−x if x ≥ 0
a.) Show that the function in a pdf. b.) Find the FY (y)−1 .

Solution:
We need to check three things 1. limx→−∞ Fx = 0,limx→∞ Fx = 1 2. non-decreasing 3. right continuous.
limx→0 1 − e−x = 0
limx→∞ 1 − e−x = 1
−x
d
dx Fx = e which is greater than zero for x > 0 therefore FX (x) is non-decreasing. 1 − e−x is continuous.
b)

FX (x) = y = 1 − e−x
1 − y = e−x
log(1 − y) = −x
− log(1 − y) = x
FY (y) = − log(1 − y)

Question 6.[15 marks]


If Y has a binomial distribution with n trails and probability of succes p.
a. show the the moment generating function for Y is

m(t) = (pet + q)n where q = 1 − p

b. Differential the moment-generation function to find E(Y ),E(Y 2 ) and the V ar(Y )
Solution:
The mfg can be found by
n  
X n x
MX (t) = ext p (1 − p)n−x
x
n  
X n
= (pet )x (1 − p)n−x
x
n  
X n x n−x
apply binomial formula u v = (u + v)n = (pet + (1 − p)n
x

5
b.) b. Differential the moment-generation function to find E(Y ),E(Y 2 ) and the V ar(Y )
d
Find dt MY (t) t=0 .
d d
MY (t) = (pet + (1 − p)n
dt dt
= n(pet + 1 − p)n−1 pet
Evaluate this at t = 0 to find E(Y )

E(X) = n(pe0 + 1 − p)n−1 pe0


= n(p + 1 − p)n−1 p
= np

d2 d
MY (t) = n(pet + 1 − p)n−1 pet
dt2 dt
= n(n − 1)(pet + 1 − p)n−2 pet · pet + n(pet + 1 − p)n−1 pet
= net p(pet + 1 − p)n−2 (n − 1)pet + (pet + 1 − p)
  

= net p(pet + 1 − p)n−2 npet − pet + pet + 1 − p


  

= net p(pet + 1 − p)n−2 npet + 1 − p


  

Evaluate this at t = 0 to find E(Y 2 )

E(Y 2 ) = ne0 p(pe0 + 1 − p)n−2 npe0 + 1 − p


  

= np(p + 1 − p)n−2 (np + 1 − p)


 

= np(np + (1 − p)

Now
V ar(Y ) = E[Y 2 ] − E[Y ]2
= (np)2 + np − np2 − (np)2
= np − np2

You might also like