mcmc diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · adaptive mcmc adaptive mcmcalters...
TRANSCRIPT
![Page 1: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/1.jpg)
MCMC Diagnostics
![Page 2: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/2.jpg)
Review
In the practical you used Metropolis-Hastings with a Gaussianproposal distribution to infer one parameter, R0
In this session we will:
• extend to multivariate inference
• learn about MCMC diagnostics
• think about accuracy and efficiency
![Page 3: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/3.jpg)
Interlude: Multivariate Gaussian distribution
To infer more multiple parameters we can use multivariate Gaussian
mean µ =[3 2
]covariance Σ =
[25 00 9
] mean µ =[3 2
]covariance Σ =
[10 55 5
]
For accurate and efficient MCMC we tune the variance andcovariance of the proposal distribution.
![Page 4: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/4.jpg)
Why I like hairy caterpillars
Key characterisitics
• Straight
• Plump head, plump rear!
• Multiple colours
![Page 5: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/5.jpg)
Choosing a proposal distribution
If variance is too small, the chain will be slow to reach the targetdistribution.
![Page 6: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/6.jpg)
Choosing a proposal distribution
If variance is too high, many proposed values will be rejected andthe chain will stick in one place for many steps.
![Page 7: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/7.jpg)
Choosing a proposal distribution
If variance is just right, the chain will efficiently explore the fullshape of the target distribution.
Try several different proposal distributions (pilot runs), aiming foran acceptance rate between 24% and 40%.
![Page 8: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/8.jpg)
Adaptive MCMC
• Adaptive MCMC alters proposal distribution while chain isrunning.
• Start with large symmetric variance, scan around to find amode.
• Then alter shape of proposal distribution to match covariancematrix of accepted values.
• Eventually proposal density should match the shape of targetdensity.
![Page 9: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/9.jpg)
Adaptive MCMC
Two-stage adaptation
![Page 10: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/10.jpg)
Burn-in
• We can start our MCMC chainanywhere.
• It can take a while to reach andexplore the target density f (θ).
• Throw away early samples: burn-inphase.
• How much to discard?
Lepidoptera caterpillar
![Page 11: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/11.jpg)
MCMC sample size
• In MCMC, each sample depends on the one before -auto-correlation
• Reduce degree of auto-correlation by thinning, only retainevery nth sample.
• Information content of MCMC samples is given by theeffective sample size (ESS).
• We use the R package coda.
![Page 12: MCMC Diagnosticssbfnk.github.io/mfiidd/slides/mcmc_slides2.pdf · Adaptive MCMC Adaptive MCMCalters proposal distribution while chain is running. Start with large symmetric variance,](https://reader036.vdocuments.mx/reader036/viewer/2022071001/5fbe6184ab91f102c40bffee/html5/thumbnails/12.jpg)
Accuracy and efficiency
How does each element influence accuracy and efficiency?
• Burn-in
• MCMC iterations (after burn-in)
• Thinning
• Number of chains (with different initial conditions)
• Proposal distribution
• Transforming parameters