This is an old version, view current version.

26.2 Computing the posterior predictive distribution

The posterior predictive density (or mass) of a prediction ˜y given observed data y can be computed using Monte Carlo draws

θ(m)p(θy) from the posterior as p(˜yy)1MMm=1p(˜yθ(m)).

Computing directly using this formula will lead to underflow in many situations, but the log posterior predictive density, logp(˜yy) may be computed using the stable log sum of exponents function as logp(˜yy)log1MMm=1p(˜yθ(m)).=logM+log-sum-expMm=1logp(˜yθ(m)), where log-sum-expMm=1vm=logMm=1expvm is used to maintain arithmetic precision. See the section on log sum of exponentials for more details.