02 Sampling algorithms
Shravan Vasishth SMLP
Shravan Vasishth 02 Sampling algorithms SMLP 1 / 43
02 Sampling algorithms Shravan Vasishth SMLP Shravan Vasishth 02 - - PowerPoint PPT Presentation
02 Sampling algorithms Shravan Vasishth SMLP Shravan Vasishth 02 Sampling algorithms SMLP 1 / 43 MCMC sampling The inversion method for sampling This method works when we know the closed form of the pdf we want to simulate from and can
Shravan Vasishth 02 Sampling algorithms SMLP 1 / 43
1
2
Shravan Vasishth 02 Sampling algorithms SMLP 2 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 3 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 4 / 43
Standard Normal
samples Density −4 −2 2 4 0.0 0.1 0.2 0.3 Shravan Vasishth 02 Sampling algorithms SMLP 5 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 6 / 43
Exponential
samples Density 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 Shravan Vasishth 02 Sampling algorithms SMLP 7 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 8 / 43
samples Density 2 4 6 8 0.0 0.2 0.4 0.6 0.8 Shravan Vasishth 02 Sampling algorithms SMLP 9 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 10 / 43
1
2
3
1 | θj−1 2
k
2 | θj 1θj−1 3
k
k | θj 1 . . . θj k−1.
4
Shravan Vasishth 02 Sampling algorithms SMLP 11 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 12 / 43
1
2
Shravan Vasishth 02 Sampling algorithms SMLP 13 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 14 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 15 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 16 / 43
◮ Propose new location using a “symmetric jumping distribution” ◮ Calculate
◮ Generate u ∼ Uniform(0, 1) ◮ r>u, move from θi to θi+1, else stay at θi Shravan Vasishth 02 Sampling algorithms SMLP 17 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Posterior
θ likelihood x prior Shravan Vasishth 02 Sampling algorithms SMLP 18 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Propose location to jump to
θ likelihood x prior Shravan Vasishth 02 Sampling algorithms SMLP 19 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Calculate ratio of proposed/current likxprior
θ likelihood x prior ratio=0.83 Shravan Vasishth 02 Sampling algorithms SMLP 20 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Calculate ratio of proposed/current likxprior
θ likelihood x prior ratio=0.83 Shravan Vasishth 02 Sampling algorithms SMLP 21 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Make new proposal, compute proposal/original ratio
θ likelihood x prior ratio=1.33 Shravan Vasishth 02 Sampling algorithms SMLP 22 / 43
−150 −100 −50 50 100 0.000 0.002 0.004 0.006 0.008
Move to new location because ratio > 1
θ likelihood x prior ratio=1.33 Shravan Vasishth 02 Sampling algorithms SMLP 23 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 24 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 25 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 26 / 43
↑
↑
Shravan Vasishth 02 Sampling algorithms SMLP 27 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 28 / 43
i
Shravan Vasishth 02 Sampling algorithms SMLP 29 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 30 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 31 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 32 / 43
−4 −2 2 4 −8 −6 −4 −2
Log density
theta −theta^2/2
Shravan Vasishth 02 Sampling algorithms SMLP 33 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 34 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 35 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 36 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 37 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 38 / 43
500 1000 1500 2000 −3 −1 1 2 3
Trace plot of posterior samples
Index theta
Shravan Vasishth 02 Sampling algorithms SMLP 39 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 40 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 41 / 43
θ Density −4 −2 2 0.0 0.2 0.4
Shravan Vasishth 02 Sampling algorithms SMLP 42 / 43
Shravan Vasishth 02 Sampling algorithms SMLP 43 / 43