Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
13 / 13 published solutions
Question 2 MCQ · 0.0 marks
6406536376435.
Useful Data has been mentioned above.
6406536376436.
This data attachment is just for a reference & not for an evaluation.
Published solution
**1. Identify the purpose of the question:**
This 0-mark introductory item displays the reference formula sheet (Useful Data) for the Statistical Computing exam and asks the candidate to acknowledge that the useful data has been provided above.
**Answer: A — Useful Data has been mentioned above.**
A: **Correct:** Standard acknowledgment option for the exam's Useful Data formula sheet.
B: **Incorrect:** Standard exam instructions require selecting Option A to confirm viewing the useful data.
Which of the following statements are true about the inverse transform method? Select all that
apply.
6406536376437.
It requires the inverse CDF of the distribution.
6406536376438.
It can be used only for continuous distribution.
6406536376439.
It maps a Uniform
variable to the target distribution.
6406536376440.
None of these.
Published solution
**1. Review the Inverse Transform Method:**
To generate a random variate \( X \) with cumulative distribution function \( F \), we draw \( U \sim \text{Uniform}(0, 1) \) and set \( X = F^{-1}(U) \), where \( F^{-1}(u) = \inf\{x : F(x) \ge u\} \) is the generalized inverse CDF.
**2. Evaluate each statement:**
- **Option A:** True, it requires evaluating the (generalized) inverse CDF \( F^{-1} \).
- **Option B:** False, the inverse transform method applies to **both** continuous and discrete distributions (using the step-function generalized inverse for discrete PMFs).
- **Option C:** True, it transforms a \( \text{Uniform}(0, 1) \) random variable \( U \) into a sample from the target distribution.
- **Option D:** False since A and C are true.
**Answer: A and C.**
A: **Correct:** The inverse transform method computes \( X = F^{-1}(U) \) using the inverse CDF.
B: **Incorrect:** The method works for discrete distributions as well by finding \( x_k \) such that \( F(x_{k-1}) < U \le F(x_k) \).
C: **Correct:** It maps \( U \sim \text{Uniform}(0, 1) \) onto the target distribution via \( F^{-1}(U) \).
D: **Incorrect:** Both A and C are true.
Suppose we want to generate samples from a discrete distribution with pmf
using the
Accept–Reject method. Two proposal distributions
and
lead to AR bounds
and
respectively, such that
. Which of the following
statements are true? Select all that apply.
6406536376441.
Both proposals generate samples from
with the same efficiency.
6406536376442.
We cannot comment on the efficiency based on the AR bounds.
6406536376443.
will produce faster samples from
.
6406536376444.
Both proposals have the same acceptance probability.
Published solution
**1. Recall Acceptance Probability in the Accept–Reject (AR) Method:**
When sampling from a target PMF \( p \) using a proposal PMF \( q_i \) with bound \( c_i = \sup_x \frac{p(x)}{q_i(x)} \), the marginal probability of accepting a proposed sample on any single iteration is:
\[
P(\text{Accept}) = \sum_x q_i(x) \frac{p(x)}{c_i q_i(x)} = \frac{1}{c_i}
\]
And the expected number of iterations per accepted sample (measuring sampling efficiency) is \( c_i \).
**2. Compare the two proposals when \( c_1 = c_2 \):**
Since \( c_1 = c_2 \), both proposals have the exact same acceptance probability \( 1/c_1 = 1/c_2 \) (**Option D is true**) and require the same expected number of proposals per accepted draw, so they have the same sampling efficiency (**Option A is true**, while Options B and C are false).
**Answer: A and D.**
A: **Correct:** Because the expected number of trials per accepted sample is \( c_i \), \( c_1 = c_2 \) implies identical AR sampling efficiency.
B: **Incorrect:** The AR bound \( c \) directly determines the acceptance rate \( 1/c \) and efficiency.
C: **Incorrect:** Neither proposal has a smaller bound \( c_i \), so \( q_1 \) is not faster than \( q_2 \).
D: **Correct:** The acceptance probability is \( 1/c_i \), so \( c_1 = c_2 \) guarantees equal acceptance probabilities.
**1. Recall the bounding box formulas for the Ratio of Uniforms (RoU) method:**
For \( f(x) = e^{-x} \mathbb{I}_{(0, \infty)}(x) \), the RoU region is:
\[
A_f = \left\{(u, v) : 0 \le u \le \sqrt{f(v/u)}\right\} = \left\{(u, v) : 0 \le u \le e^{-v/(2u)},\ v > 0\right\}
\]
The bounding box \( [0, a] \times [b, c] \) is given by:
- \( a = \sup_{x > 0} \sqrt{f(x)} = \sup_{x > 0} e^{-x/2} = 1 \)
- \( b = \inf_{x > 0} x \sqrt{f(x)} = \inf_{x > 0} x e^{-x/2} = 0 \)
- \( c = \sup_{x > 0} x \sqrt{f(x)} = \sup_{x > 0} x e^{-x/2} \)
**2. Maximize \( g(x) = x e^{-x/2} \) for \( x > 0 \):**
Setting the derivative to zero:
\[
g'(x) = e^{-x/2}\left(1 - \frac{x}{2}\right) = 0 \implies x = 2
\]
Substituting \( x = 2 \) gives \( c = g(2) = 2 e^{-1} \). Thus, \( a = 1,\ b = 0,\ c = 2e^{-1} \).
**Answer: B — \( a = 1,\ b = 0,\ c = 2e^{-1} \).**
A: **Incorrect:** Gives \( c = e^{-1} \) instead of \( 2e^{-1} \).
B: **Correct:** \( a = \sup e^{-x/2} = 1 \), \( b = 0 \), and \( c = \sup_{x>0} x e^{-x/2} = 2e^{-1} \) at \( x = 2 \).
C: **Incorrect:** Since \( x > 0 \), \( v = u x \ge 0 \), so the lower bound \( b \) is \( 0 \), not \( -2e^{-1} \).
D: **Incorrect:** Both \( a \) and \( c \) are miscalculated.
**1. Read the inverse transform function from the Python code:**
The code defines `inv_cdf(u, a, c)` as `c * (u ** (1 / a))`, meaning:
\[
X = F^{-1}(U) = c U^{1/a} \quad \text{for } U \in [0, 1]
\]
**2. Invert \( x = F^{-1}(u) \) to find the CDF \( u = F(x) \):**
For \( 0 \le x \le c \):
\[
x = c u^{1/a} \implies \frac{x}{c} = u^{1/a} \implies u = F(x) = \frac{x^a}{c^a}
\]
With \( F(x) = 0 \) for \( x < 0 \) and \( F(x) = 1 \) for \( x > c \), this matches Option A.
**Answer: A — \( F(x) = \frac{x^a}{c^a} \) for \( 0 \le x \le c \).**
A: **Correct:** Solving \( x = c u^{1/a} \) for \( u \) gives \( F(x) = x^a / c^a \) on \( 0 \le x \le c \).
B: **Incorrect:** \( x^{1/a}/c \) fails to invert the power \( 1/a \).
C: **Incorrect:** \( (x/c)^{1/a} \) is the forward formula \( F^{-1} \) rather than its inverse.
D: **Incorrect:** \( c x^a \) multiplies by \( c \) instead of dividing by \( c^a \).
Below code snippet implements an inverse transform method. Study the code carefully and
answer the given subquestions.
Based on the inverse CDF plot and the histogram of generated samples, select all correct
statements.
6406536376457.
The density of
increases as
increases.
6406536376458.
The inverse CDF plot indicates that values near 0 on the horizontal axis
produce small values of
.
6406536376459.
The distribution of
is left skewed.
6406536376460.
The distribution of
is right skewed.
Published solution
**1. Analyze the PDF and plots for \( a = 5, c = 10 \):**
Differentiating \( F(x) = (x / 10)^5 \) on \( [0, 10] \) gives the PDF:
\[
f(x) = F'(x) = \frac{5 x^4}{10^5}, \quad 0 \le x \le 10
\]
**2. Check each statement:**
- **Option A:** Since \( f(x) \propto x^4 \) for \( x \in [0, 10] \), the density of \( X \) strictly increases as \( x \) increases (also visible from the histogram bars growing taller toward \( x = 10 \)). True.
- **Option B:** On the inverse CDF plot \( x = 10 u^{1/5} \), when \( u \) on the horizontal axis is near \( 0 \), \( x \) is also near \( 0 \) (small values of \( X \)). True.
- **Option C & D:** Because the bulk of the probability mass is concentrated near the right boundary \( x = 10 \) with a long tail stretching toward \( 0 \) on the left, the distribution is **left-skewed** (negatively skewed). Thus **Option C is true** and **Option D is false**.
**Answer: A, B, and C.**
A: **Correct:** Both the histogram and the derivative \( f(x) = 5x^4 / 10^5 \) show that the density increases with \( x \).
B: **Correct:** Near \( u = 0 \) on the horizontal axis, \( F^{-1}(u) = 10 u^{1/5} \) is near \( 0 \).
C: **Correct:** The histogram has a long left tail toward 0 and peaks at 10, which is a left-skewed distribution.
D: **Incorrect:** The tail is on the left, not the right.
Below code snippet implements an inverse transform method. Study the code carefully and
answer the given subquestions.
If
, then compute the value of
. Enter the answer correct to one decimal place.
Published solution
**1. Set up the inverse CDF formula from the code:**
From the code snippet, \( a = 5 \), \( c = 10 \), and:
\[
X = c \cdot U^{1/a} = 10 \cdot U^{1/5}
\]
**2. Substitute \( U = 0.243 \):**
Notice that \( 0.243 = \frac{243}{1000} = \frac{3^5}{10^3} \), or directly:
\[
(0.243)^{0.2} \approx 0.75355
\]
Multiplying by \( c = 10 \):
\[
X = 10 \times 0.75355 = 7.5355 \approx 7.5
\]
(Note: if \( U = 0.243 \) was intended alongside \( 3/4 = 0.75 \) from \( 0.243 \approx (0.75)^5 = 0.2373 \), both give \( 7.5 \) to one decimal place!)
**Answer: 7.5.**
**1. Analyze the mixture simulation procedure:**
The algorithm draws \( U \sim \text{Uniform}(0, 1) \) and sets:
- \( X = X_1 \) if \( U < 0.6 \) (which occurs with probability \( 0.6 \))
- \( X = X_2 \) otherwise (which occurs with probability \( 1 - 0.6 = 0.4 \))
**2. Apply the Law of Total Probability:**
\[
P(X = k) = P(U < 0.6) P(X_1 = k) + P(U \ge 0.6) P(X_2 = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)}
\]
**Answer: D — \( P(X = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)} \).**
A: **Incorrect:** Swaps the mixture weights \( 0.6 \) and \( 0.4 \).
B: **Incorrect:** Multiplies the PMFs instead of taking their convex combination.
C: **Incorrect:** Sums the unweighted PMFs (which would sum to 2 instead of 1).
D: **Correct:** By the law of total probability, \( P(X = k) = 0.6 p_k^{(1)} + 0.4 p_k^{(2)} \).