160

# Typical Sets: What They Are and How to (Hopefully) Find Them

Although typical sets are important in understanding how/why sampling algorithms (do not) work, they are rarely taught when most astronomers are introduced to sampling methods such as Markov Chain Monte Carlo (MCMC). I introduce the idea of typical sets using some basic examples and show why they make sampling difficult in higher dimensions. I then outline how their behavior shapes various MCMC algorithms such as (Adaptive) Metropolis-Hastings, ensemble sampling, and Hamiltonian Monte Carlo. See https://github.com/joshspeagle/typical_sets for additional resources.

## Josh Speagle

September 20, 2017

## Transcript

1. ### Typical Sets: What They Are and How to (Hopefully) Find

Them Josh Speagle jspeagle@cfa.harvard.edu Based on this talk by Michael Betancourt at StanCon.

statistics.
3. ### Intended Audience • Some experience with the basics of Bayesian

statistics. • Some experience using MCMC for research.
4. ### Intended Audience • Some experience with the basics of Bayesian

statistics. • Some experience using MCMC for research. • Have heard of ensemble sampling methods such as emcee.

6. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem
7. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Parameters
8. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Data Parameters
9. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Data Parameters Model
10. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem
11. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Prior
12. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Prior Likelihood
13. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Prior Likelihood Posterior
14. ### Bayesian Inference Pr , M = Pr , M Pr

|M Pr M Bayes’ Theorem Prior Likelihood Posterior Evidence
15. ### Bayesian Inference = ℒ Bayes’ Theorem ≡ Ω ℒ Posterior

Likelihood Prior Evidence

≡ Ω ℒ

25. ### Typical Sets: Gaussian Example ∝ 0 ∞ − 2 2

∝ 0 ∞ − 2 2 −1

30. ### = Where is the posterior? ≡ 0 ∞ “Typical Set”

MCMC wants to draw samples from this “shell”

′ ′

′ ′ Proposal

′ ′ “Volume”
34. ### Tension in the Metropolis Update ′ = min 1, ′

′ ′ “Volume” “Amplitude”

Separation
42. ### Ideal Metropolis-Hastings ′ = Normal ′ = , = Typical

Separation M-H

50. ### emcee ′ = min 1, ′ −1 ~ = 1

from 1 , 0 otherwise “Stretch” factor

probability
55. ### emcee ′ = min 1, ′ −1 ~ = 1

from 1 , 0 otherwise “Stretch” factor
56. ### emcee ′ = min 1, ′ −1 ~ = 1

from 1 , 0 otherwise “Stretch” factor 
57. ### Summary • Volume scales as . • The posterior density

depends on both volume and amplitude. • Most of the posterior is concentrated in a “shell” around the best solution called the typical set. • MCMC draws samples from the typical set.

65. ### Hamiltonian Monte Carlo Treat the particle at position q as

a point mass with mass matrix M and momentum p. Pr , ∝ , = − −1 2 Hamiltonian
66. ### Hamiltonian Monte Carlo Pr , ∝ , = − −1

2 Treat the particle at position q as a point mass with mass matrix M and momentum p. = = −1 = − = ln Hamiltonian Hamilton’s Equations
67. ### Hamiltonian Monte Carlo ′, −′ , = min 1, Pr

′, −′ Pr , ∼ Normal = , =

= , =

= , = HMC