 # STM4PSD ASSIGNMENT 2

## ASSIGNMENT 2 Assignment help

Question 1. (5 marks). Let X ∼ NB(4, 0.132). Calculate each of the following:
(a) E(X), Var(X) and SD(X).
(b) P(X ≤ 1)
(c) P(X > 2)
(d) P(6 < X ≤ 8)
(e) P(X ≤ 1 | X < 3)

Complete Question 1 by hand, showing all working. In particular, you must determine all relevant binomial coefficients
exactly and show the associated working. You may use a calculator to determine final answers. Give final answers to
at least 3 decimal places.

Question 2. (4 marks). For each of the scenarios below:
i. Define an appropriate random variable for the scenario by describing it in a sentence.
ii. State the probability distribution the random variable you defined in (i) would follow.
iii. Use properties of that random variable to perform a calculation or calculations that would be needed to answer
the question(s).

(a) A fair coin is flipped until heads is obtained exactly 5 times. What is the expected number of tails, and what is
the probability that at least 3 tails are flipped?
(b) A small business is running a promotion wherein customers who make a purchase are entered into a prize draw.
Each customer who makes a purchase has a 1/12 chance of winning a promotional item from the business.
During the promotional time, 322 customers make a purchase. Each promotional item will cost the business
\$5.75, and the business owner has set a budget of \$300. What is the expected cost to the business, and what is
the probability that the promotion goes over the budget?
(c) On an average day, a website has 554 visitors. Each visitor to the website has a 0.1% chance of signing up for a
paid premium account. What is the probability that no paid premium accounts are signed up for on an average
day?
(d) You have been asked to monitor a machine that manufactures small parts. The machine builds one part at a
time, but due to random chance, an average of 3% of parts are faulty and they cannot be used. Another company
has asked you to build 120 of these small parts, and all of them must be working (i.e., not faulty). The machine
can produce exactly 40 parts per day (faulty and working combined) before it must be paused for maintenance.
If the manufacturing process starts on day 1, what is the expected day that all 120 parts will be ready for the
other company, and what is the probability that the parts will be ready on an earlier day than that?

You may complete Question 2 using R, or by hand, or any combination of both. If using R, submit the code you used
and the final answer. If computing by hand, show all working. You may assume that all trials are independent. You
may use a calculator to determine final answers. Give final answers to at least 3 decimal places.

Question 3. (6 marks). Consider the following function:
f(x) =


12−3x
16 if 2 ≤ x ≤ 4,
5x−25
4 if 5 ≤ x ≤ 6,
0 otherwise.
(a) Sketch the graph of f(x) on a suitable range of x values.
(b) Explain why f is a valid probability density function.
Now assume that Z is a random variable whose probability density function is f.
(c) Use your graph and properties of probability to determine each of the following:
(i) P(Z ≥ 4)
(ii) P(Z < 3)
(iii) P(Z ≥ 5
2 )
(iv) P( 5
2 ≤ Z ≤ 4)
(d) You are given the following: if 2 ≤ x ≤ 4, then P(Z ≤ x) = 24x−3×2−36
32 . Determine similar formulas for P(Z ≤ x)
when 4 < x < 5 and when 5 ≤ x ≤ 6, and use them to to write down the probability distribution function for Z.
Complete Question 3 by hand, showing all working. Give all final answers exactly. You must clearly explain how you
Question 4. (5 marks). For this question, we will say that a continuous random variable X follows a mystery
distribution with parameters a and b (with a, b > 0) if the probability density function for X is given by
fX(x) =


4b
x ·
􀀀x
a
4b ·
􀀀x
a
4 + 1
−b−1
if x > 0
0 otherwise.

In that case, we write X ∼ Mystery(a, b).
(a) Write an R function dmystery with three arguments x, a and b, which computes this probability density function.
Ensure your function is vectorised for the remaining parts of this question; you may use Vectorize as in the
lab classes.
Use correct syntax to define a function, i.e., dmystery <- function(x,a,b) { … }
(b) Write an R function pmystery with three arguments x, a and b, which calculates P(X ≤ x) for X ∼ Mystery(a, b).
Your pmystery function must make use of R’s built in integrate function.
(c) Write an R function emystery with two arguments a and b, which calculates E(X) for X ∼ Mystery(a, b). This
function does not require the x argument. Define the function using emystery <- function(a,b) { … }
(d) Write an R function vmystery with two arguments a and b, which calculates Var(X) for X ∼ Mystery(a, b).
(e) For X ∼ Mystery(1, 4), use your functions to determine:
(i) E(X), Var(X) and SD(X)
(ii) P(X ≥ 2.604)
(iii) P(1.906 < X ≤ 2.741)
For parts (a), (b), (c) and (d), include the code you wrote in your submission. For part (e), include the code you
used and the final answers, to at least 3 decimal places.

By |2023-01-31T12:07:18+00:00January 31st, 2023|Categories: Assignment Samples|Tags: |0 Comments 