1. Direct simulation from the posterior

In simple Bayesian models, especially those with conjugate priors, we can draw samples directly from the posterior $p(\theta | y)$.

  • Example: In a normal–normal or beta–binomial model, the posterior has a known closed form, so drawing samples is straightforward.

When models get more complex:

  • We may factorize the posterior into simpler conditional parts, e.g.:
    1. Sample hyperparameters from their marginal posterior.
    2. Then sample lower-level parameters given those hyperparameters and the data.

This “factorized simulation” approach was used in hierarchical examples from earlier chapters (like the rat-tumor model).

If some parts of the model allow for analytic integration, it’s efficient to integrate those parts out and simulate the rest.


2. Direct approximation using a grid

For very low-dimensional problems (say, 1 or 2 parameters):

Grid-based approach:

  1. Choose evenly spaced points $\theta_1, \ldots, \theta_N$​ covering the range of plausible parameter values.
  2. Compute the (possibly unnormalized) posterior density $q(\theta_i | y)$ at each grid point.
  3. Normalize to get a discrete approximation: .
    • $P_i = \frac{q(\theta_i | y)}{\sum_{j=1}^N q(\theta_j | y)}$
  4. To draw a random sample:
    • Draw a uniform random number $U \sim \text{Uniform}(0,1)$,
    • Use the inverse CDF method to map $U$ to one of the grid points.

Works well when:

  • Posterior is unimodal and one-dimensional.
  • Grid is fine enough and covers all important regions.

Fails when:

  • The parameter space is high-dimensional (computationally infeasible to evaluate on dense grids).

3. Simulating from posterior predictive distributions

Once you have posterior draws $\theta^{(s)}$ from $p(\theta | y)$, you can simulate future or unobserved data easily:

  1. For each posterior sample $\theta^{(s)}$, draw a new value:
    • $\tilde{y}^{(s)} \sim p(\tilde{y} | \theta^{(s)})$
  2. The collection of $\tilde{y}^{(s)}$ values represents samples from the posterior predictive distribution:
    • $p(\tilde{y} | y) = \int p(\tilde{y} | \theta) p(\theta | y) \, d\theta$

This is a fundamental step for model checking and prediction, as discussed.


4. Rejection Sampling

Goal:

Draw samples from a target density $p(\theta | y)$ (or an unnormalized version $q(\theta | y)$.

Requirements:

We need a simpler proposal function $g(\theta)$ satisfying:

  1. We can easily draw samples from a distribution proportional to $g(\theta)$.
  2. There exists a finite constant $M$ such that:
    • $p(\theta | y) \le M \, g(\theta) \quad \text{for all } \theta$

The algorithm

  1. Draw $\theta^\*$ from the proposal distribution proportional to $g(\theta)$.
  2. Accept $\omega^\*$ with probability:
    • $\text{Accept } \theta^\* \text{ with prob } \frac{p(\theta^\* | y)}{M \, g(\theta^\*)}$ Otherwise, reject and go back to step 1.
  3. Repeat until you have enough accepted samples.

Why it works

  • The accepted draws come from the correct posterior $p(\theta | y)$.
  • The boundedness condition ensures the acceptance probability is ≤ 1.

Efficiency considerations

  • Ideal case: $g(\theta) \propto p(\theta | y)$
    → Every sample is accepted (100% efficiency).
  • Poor case: $g(\theta)$ doesn’t match $p(\theta | y)$ well
    → $M$ must be large, and most samples get rejected → inefficiency.

The acceptance rate itself tells you how well $g$ approximates $p$ —
so rejection sampling is self-monitoring.


Practical uses

  • Works best for univariate or low-dimensional problems.
  • Common in:
    • Sampling from standard distributions (fast methods for univariate cases).
    • Sampling from truncated distributions, if the truncated region is not too large.

Visualization

  • Top curve: $M g(\theta)$ — the bounding envelope.
  • Bottom curve: $p(\theta | y)$ — target distribution.
  • Randomly sample under the top curve.
  • Accept points that fall under the bottom curve.

If the two curves are close → high acceptance rate.
If not → most samples get rejected.


Key Takeaways

MethodIdeaWhen usefulProsCons
Direct simulationSample directly from posterior if availableSimple conjugate modelsExact, fastOnly works for simple forms
Grid approximationEvaluate posterior on grid, normalize1D or 2D problemsSimple conceptuallyImpossible for high dimensions
Predictive simulationDraw future data given posterior samplesAny modelEnables model checking & predictionRequires posterior draws first
Rejection samplingAccept/reject based on bounding densitySmall, well-behaved problemsAlways correctVery inefficient in high dimensions

In summary:
Direct simulation and rejection sampling are foundational Bayesian computation techniques—conceptually simple and exact—but in practice, they are limited to low-dimensional problems. For complex hierarchical or high-dimensional models, more sophisticated algorithms (like importance sampling and MCMC) are needed.