MCMC Sampling and Boundary Penalty

Use this forum to post Vensim related questions.
Post Reply
aliakhavan89
Senior Member
Posts: 134
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

MCMC Sampling and Boundary Penalty

Post by aliakhavan89 »

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.
Screenshot 2024-07-16 at 3.53.14 PM.png
Screenshot 2024-07-16 at 3.53.14 PM.png (80.27 KiB) Viewed 4386 times
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: MCMC Sampling and Boundary Penalty

Post by tomfid »

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.
aliakhavan89
Senior Member
Posts: 134
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: MCMC Sampling and Boundary Penalty

Post by aliakhavan89 »

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 137 times
Payoff.vpd
(47 Bytes) Downloaded 132 times
RandomWalk2.mdl
(4.55 KiB) Downloaded 134 times
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: MCMC Sampling and Boundary Penalty

Post by tomfid »

What param are we looking at in the histogram?
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: MCMC Sampling and Boundary Penalty

Post by tomfid »

Oops - missing data.vdfx.
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: MCMC Sampling and Boundary Penalty

Post by tomfid »

Anyway ... I can replicate this with a simpler example, so no need. Will explore a better boundary reflection approach.
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: MCMC Sampling and Boundary Penalty

Post by tomfid »

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.
aliakhavan89
Senior Member
Posts: 134
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: MCMC Sampling and Boundary Penalty

Post by aliakhavan89 »

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!
Screenshot 2024-07-18 at 2.45.40 PM.png
Screenshot 2024-07-18 at 2.45.40 PM.png (371.21 KiB) Viewed 4290 times
Attachments
Vensim Likelihood Test.zip
(914.48 KiB) Downloaded 133 times
aliakhavan89
Senior Member
Posts: 134
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: MCMC Sampling and Boundary Penalty

Post by aliakhavan89 »

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.
Post Reply