MCMC Sampling and Boundary Penalty
-
- Senior Member
- Posts: 192
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
MCMC Sampling and Boundary Penalty
Is there a way to avoid sampling from parameter boundaries, apart from manually defining a penalty term in the payoff function? I am fine to get a uniform distribution if MCMC cannot recover a proper posterior distribution. By the way, I have not defined a probability distribution for the prior.
Re: MCMC Sampling and Boundary Penalty
I guess the likelihood was also uniform over this experiment?
Reflecting off the boundaries is tricky in multidimensions, but we could probably improve on this behavior. In the short run I don't have a good solution though.
A couple possibilities would be to use the logistic transform on the parameter, or give it a Beta prior. For the latter, you can ignore the gamma terms and use x^(a-1)*(1-x)^(b-1) with a=b>>1.
It might be possible to suggest other options if we knew what the param represents.
Reflecting off the boundaries is tricky in multidimensions, but we could probably improve on this behavior. In the short run I don't have a good solution though.
A couple possibilities would be to use the logistic transform on the parameter, or give it a Beta prior. For the latter, you can ignore the gamma terms and use x^(a-1)*(1-x)^(b-1) with a=b>>1.
It might be possible to suggest other options if we knew what the param represents.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 192
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: MCMC Sampling and Boundary Penalty
Thank you! It is a normal log-likelihood. I have attached the toy model here. These are great suggestions. I think defining a prior and including it (mean and standard deviation) in the payoff as the initial condition would resolve the issue. But I guess I should keep the barrier penalty.
- Attachments
-
- MCMC_Settings.voc
- (615 Bytes) Downloaded 281 times
-
- Payoff.vpd
- (47 Bytes) Downloaded 273 times
-
- RandomWalk2.mdl
- (4.55 KiB) Downloaded 278 times
Re: MCMC Sampling and Boundary Penalty
What param are we looking at in the histogram?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: MCMC Sampling and Boundary Penalty
Oops - missing data.vdfx.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: MCMC Sampling and Boundary Penalty
Anyway ... I can replicate this with a simpler example, so no need. Will explore a better boundary reflection approach.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: MCMC Sampling and Boundary Penalty
Misspoke earlier though. For the Beta coefficients, a=b>>1 gives a centered Normalish distribution around 0.5. If you want something flattish, but avoiding extremes, you'd want 1<a=b<2.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 192
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: MCMC Sampling and Boundary Penalty
Hi Tom, Sorry for not uploading the data. I have attached the whole folder here. I did a quick test with the boundary penalty, and it gave a me a very good result, though I added an additional parameter (Exp Sigma, which is not shown in the graph). I'll try to implement your suggestions. Thanks a lot!
- Attachments
-
- Vensim Likelihood Test.zip
- (914.48 KiB) Downloaded 276 times
-
- Senior Member
- Posts: 192
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: MCMC Sampling and Boundary Penalty
I borrowed the boundary penalty formulation from a template that normalizes the estimated parameters, but I didn't properly adjust the equation based on the parameter boundaries I have in the model. So, I got it to work by accident. I'll share a revised version, though now I have some doubts about the template.
Re: MCMC Sampling and Boundary Penalty
I modified the hard bounds constraint behavior so the concentration of mass at the bound no longer happens, at least in a case like this with a uniform likelihood and (implicitly) flat prior over a unit hypercube.
It probably still makes sense to apply some kind of prior within the range. We plan to make this easier, so that you can specify priors within the .voc list, though more complex situations (hierarchy) may still require equations.
It probably still makes sense to apply some kind of prior within the range. We plan to make this easier, so that you can specify priors within the .voc list, though more complex situations (hierarchy) may still require equations.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: MCMC Sampling and Boundary Penalty
This experiment does suggest another interesting case: if all the likelihoods and/or priors have a beta distribution with small a,b then all the density should be concentrated at the extremes of the range (or worse, the corners of the hypercube if it's multidimensional). In theory the algorithm can handle this, but I'm not sure how true it is in practice. It might make sense to apply some kind of rank transformation to normalize things.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/