halasadi / MAPS

software for the MAPS method
MIT License
24 stars 6 forks source link

trouble-shooting MCMC #9

Closed halasadi closed 6 years ago

halasadi commented 7 years ago

I implemented suggestions as setting the rate of long-range proposals to 0, and running multiple mcmc's with temperature 1 and they give sensible results.

diagonostics

Here, I show the results of running multiple the mcmc ladder with all temperature 1 to diagonose the problem.

Here, is the once chain version

one_chain

And here, is the multiple chains version

4chains

Another multiple chains version with another random seed

5chains

Now, multiple chains with different temperatures (2, 1.5, 1.25, 1)

5chains_different_temps

It's hard to say something is obviously wrong here.

R code implementation

Next, I implemented the same version used in the C++ code in R. The results seem sensible.

stephens999 commented 7 years ago

great. I assume this is all under your EEMs2 model, rather than some simplification/toy setting?

Can I clarify are you saying the R version seems sensible but the C++ results don't?

halasadi commented 7 years ago

@stephens999 Yes, this is under the EEMS2 model.

For the R code implementation, I basically tried (as close as possible) to reproduce the C++ code into R to spot any design issues in the MCMC. I ran the R code for simple cases (mixtures of normals as the target distribution and now trying mixtures of multivariate normals ) and the results seem sensible. So I am saying that I can't find obvious problems in any of the two results (C++ and R).

halasadi commented 7 years ago

mcmc-ladder.pdf

halasadi commented 7 years ago

@stephens999 For the simple N(0,1) example you suggested, it seems like the most important thing to consider is the proposal distribution. If the proposal distribution is large enough than the hottest chain is able to explore the entire space pretty well. If it's too small then the colder chains just explore around the middle of no-where. In the below example, the proposal distribution is small. But if I made it bigger than I find the coldest chain samples from N(0,1) reasonably well.

mcmc-ladder-small-proposal.pdf

halasadi commented 7 years ago

For 40 demes (in which it converges)

_dffree ~ 0.02

Rep0

plot_4_inf-mrates01

Rep1

plot_4_inf-mrates01

Rep 2

plot_4_inf-mrates01

mindf = 1

Rep 0 plot_4_inf-mrates01

Rep 1 plot_4_inf-mrates01

Rep 2

plot_4_inf-mrates01

mindf = 2

Rep0 plot_4_inf-mrates01

Rep1 plot_4_inf-mrates01

Rep2

plot_4_inf-mrates01

halasadi commented 6 years ago

Implemented Poisson with boot-strap to correct for curvature of likelihood