Acceptance_and_Rejection_Random_number_generation
Acceptance_and_Rejection_Random_number_generation
generation
Umesh Pathak
December 2024
This method is especially useful when the inverse CDF method is difficult
to apply or when sampling from complex distributions.
—
Key Idea:
Proposal Distribution (q(x)): A distribution from which it’s easy to gen-
erate random numbers.
Target Distribution (p(x)): The distribution you want to sample from.
Scaling Constant (M): A constant that ensures the proposal distribution
is always greater than or equal to the target distribution. It must satisfy
these conditions:
1
**Steps in the Acceptance-Rejection Method**
4. **Acceptance or Rejection**:
- Accept the proposed number x∗ with probability:
p(x∗ )
Accept if u ≤ .
M · q(x∗ )
- If accepted, return x∗ .
- If rejected, repeat the process until you accept a value.
—
**Example: Generating Random Numbers from a Normal Dis-
tribution**
Suppose we want to generate random numbers from a **Normal distri-
bution** with mean µ = 0 and standard deviation σ = 1, but we only know
how to sample from a **Uniform distribution**.
**Step 1: Choose a Proposal Distribution** - We can use a **Uniform dis-
tribution** as the proposal distribution q(x), which is easy to sample from.
**Step 2: Determine the Scaling Constant (M)** - The Normal distribution
has a bell-shaped curve, and the Uniform distribution is rectangular. To
ensure that the scaling constant M satisfies M · q(x) ≥ p(x), we can use M
that is sufficiently large to cover the Normal distribution’s peak.
2
- Typically, the constant M is chosen based on the maximum value of the
target distribution p(x).
p(x∗ )
u≤
M · q(x∗ )
- If x∗ is accepted, return the value; otherwise, repeat the process.
—
3
4. **Generate Random Numbers**:
- Sample x∗ from the uniform distribution q(x) on the interval [−3, 3].
- Generate a uniform random number u from U (0, 1). - Accept x∗ if u ≤
p(x∗ )
M ·q(x∗ )
, otherwise reject it.
—
**Advantages of the Acceptance-Rejection Method**
1. **Flexibility**:
- Works for any target distribution with a known probability density function
(PDF), as long as a proposal distribution can be chosen.
2. **Simplicity**:
- The method is conceptually simple and requires no complex mathematical
computations beyond the sampling process.
—
**Limitations**
1. **Efficiency**: - The method can be inefficient if the proposal distribu-
tion q(x) is not close enough to the target distribution p(x), as many random
numbers might be rejected.
2. **Choice of Proposal Distribution**:
- Selecting a good proposal distribution is critical to the performance of this
method. A poor choice can result in many rejections.