Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STA237 (Probability, Statistics and Data Analysis I) - Fall 2022

Selvakkadunko Selvaratnam

Assignment 2

Instruction: Answers for each question must be submitted into a proper section on Crowdmark. Thank you.

Q1. Assume that the duration of human pregnancies can be described by a Normal model

with mean 270 days and standard deviation 15 days.

(a) What percentage of pregnancies should last between 260 and 275 days? (b) At least how many days should the longest 20% of all pregnancies last?

(c)  Suppose a certain obstetrician is currently providing prenatal care to 60 preg- nant women.  What is the probability that the mean duration of these patients’ pregnancies will be less than 265 days.

(d) What is the probability that the mean duration of these patients’ pregnancies will be between 265 and 269 days.

Q2.  Suppose that the random variables Y1  and Y2  have joint probability density function,

f (y1 , y2 ), given by

f (y1 , y2 ) = ,0(6)y,1(2)

(a)  Show that the marginal density of Y1  is a beta density with α = 3 and β = 2. (b) Find P (Y2  ≥ 1|Y1  ≥ 0.5).

(c) Derive the conditional density of Y2  given Y1  = y1 .

(d) Find P (Y2  > 0.8|Y1  = 0.5).

Q3.  Given here is the joint probability function associated with data obtained in a study of

automobile accidents in which a child (under age 5 years) was in the car and at least one fatality occurred. Specifically, the study focused on whether or not the child died and what type of seatbelt (if any) he or she used. Define

Y1  =    and Y2  =,     ed(us)ed,

The joint probability mass function of discrete random variables Y1  and Y2  is given by

1

y2         0        1

0    0.15   0.35

1    0.06   0.26

2    0.03   0.15

(a) Find P (Y1  ≤ 1, Y2  ≤ 1).

(b)  Give the marginal probability functions for Y1  and Y2 .

(c)  Give the conditional probability function for Y2  given Y1  = 0.

(d) What is the probability that a child died given that he or she was in an adult belt?

Q4.  Consider the continuous random variable X with pdf given by

exp(x)     

(1 + exp(x))2

X is said to have a standard logistic distribution.

(a) Find the cumulative distribution function (cdf) for the random variable X .        (b)  Show how to simulate a random variable with this cdf using the inversion method.

(c)  Generate a random sample with size 100000 for this density function using the discussed method in Part (b).

(d) Plot a probability histogram for the generated sample together with the given exact density function.

Q5. A random variable X follows a Poisson distribution with a parameter λ, let F (x) =

P (X ≤ x) and p(x) = P (X = x).

λ    

(x + 1)

(b) Using part (a) write a function in RStudio to calculate p(x) for any x = 0, 1, 2,....

(c) Using part (b) write a function in RStudio to compute F (x) for any x = 0, 1, 2,....

(d) You can simulate X using the following format of the program: F.rand = function () ↓

u = runif(1)

x = 0

while (F(x) < u) ↓

x = x + 1

ψ

return(x)

ψ

In the case of the Poisson distribution, this program can be made more efficient by calculating F just once, instead of recalculating it every time you call the function F (x).  By using two new variables, p.x and F.x for p(x) and F (x) respectively, modify this program so that instead of using the function F (x) it updates p.x and F.x within the while loop. Your program should have the form

F.rand = function (lambda) ↓

u = runif(1)

x = 0

p.x = ?

F.x = ?

while (F.x < u) ↓

x = x + 1

p.x = ?

F.x = ?

ψ

return(x)

ψ

(e)  Generate a random sample with size  100000 for the random variable X  that follows a Poisson distribution with a parameter λ = 5 using the written program in (d).

(f) Plot a probability histogram for the generated sample in (e) together with the exact probability mass function with a parameter λ = 5 using connected lines.

Q6. The management at a fast-food outlet is interested in the joint behavior of the random

variables Y1 , defined as the total time between a customer’s arrival at the store and departure from the service window, and Y2 , the time a customer waits in line before reaching the service window.  Because Y1  includes the time a customer waits in line, we must have Y1  ≥ Y2 .  The relative frequency distribution of observed values of Y1 and Y2  can be modeled by the probability density function

f(y1 , y2 ) =

with time measured in minutes.

(a) Find P (Y1 Y2  ≥ 1).

(b) Find the marginal density functions for Y1  and Y2 .

(c) What is the conditional density function of Y1  given that Y2  = y2 ?

(d) What is the conditional density function of Y2  given that Y1  = y1 ?

(e) Is the conditional density function f(y1 |y2 ) that you obtained in part (c) the same as the marginal density function f1 (y1 ) found in part (b)?