Source: Lecture PDF · Lecture index

CDF: the distribution to reproduce

The cumulative distribution function is . It determines the entire distribution, since

For an absolutely continuous distribution, . Matching the support, mean or variance alone does not establish the correct distribution. A density value is not the probability of the single point .

Inverse CDF sampling

Draw and set

The generalised inverse handles jumps and flat portions of a CDF. An ordinary inverse requires stricter conditions than continuity alone.

For a continuous strictly increasing CDF, the proof is

Thus the transformed variable has the desired CDF.

Exponential example: for rate ,

Equivalently use , since is also uniform. Mean is ; do not confuse rate with scale. Avoid evaluating at numerical endpoints.

Discrete example: if , form and return the first with . For probabilities , the intervals are , , .

Normal example: has the standard normal distribution. Without a direct inverse routine, solve numerically. The lecture’s implementation combines integration and root finding, making each draw expensive; theoretical applicability does not imply computational efficiency.

Acceptance–rejection sampling

The lecture’s geometric idea: generate candidate points uniformly in a rectangle and retain points under the target density. More points survive in regions of higher density.

For target density supported on , choose :

  1. Draw independent and .
  2. If , return ; otherwise redraw both.

The accepted horizontal coordinate has density proportional to . When the rectangle encloses the entire normalised density, acceptance probability is .

Rectangle limitation: a finite horizontal interval cannot cover the entire normal support. Restricting normal candidates to and filtering below produces a truncated normal, an approximation to the full normal if tail mass is small. Enlarging the rectangle reduces truncation but can waste more proposals.

The general density-envelope form makes the requirement explicit. Choose an easy proposal density and finite such that everywhere, then draw , independent , and accept if

For normalised , acceptance rate is and expected proposals per accepted draw is . The proposal must cover the target support; an invalid envelope gives an invalid sampler.

MethodMain operationMain computational issue
Inverse CDFTransform one uniform draw using a quantileInversion may be expensive; one output per input
Acceptance–rejectionFilter proposals using density valuesA random number of proposals is needed; poor envelopes waste draws

Markov chain Monte Carlo

Monte Carlo estimates quantities using simulated draws. MCMC constructs a Markov chain with the desired target as its stationary distribution, then uses its trajectory for estimation. This builds on L8; stationary distribution alone does not guarantee convergence from an arbitrary start.

For target and a symmetric proposal , the Metropolis rule is:

  1. From current state , propose .
  2. Accept with probability .
  3. If rejected, remain at ; record that repeated state in the chain.

Moves to larger target density are accepted; moves to smaller density can also be accepted. The normalising constant cancels in the ratio. The simple ratio requires proposal symmetry; asymmetric proposals need a proposal-probability correction.

After an initial transient, estimate expectations by averaging along the chain. Consecutive MCMC draws are generally dependent. Discarding an initial burn-in can reduce initialisation effects but does not itself prove convergence. Unlike independent rejection sampling, an MCMC rejection still contributes an observation of the current state.

Connections

  • L8: discrete inverse CDF sampling selects the next state from a transition column.
  • L7: a simulated p-value is an average of tail indicators; the sampling mechanism must reproduce the intended distribution.
  • L4: numerical inverse-CDF sampling can become a root-finding problem.
  • L10: simulation can evaluate a fixed policy; value iteration uses known transitions to optimise without enumerating simulated policies.

For lecture examples: inversion, pp. 4–15 · acceptance–rejection, pp. 16–27 · Metropolis, pp. 28–30.