Use of MCMC

Use this forum to post Vensim related questions.
Post Reply
rodrigo?solis
Member
Posts: 22
Joined: Mon Jan 21, 2019 11:41 pm
Vensim version: DSS

Use of MCMC

Post by rodrigo?solis »

Hi, I am just starting to explore the MCMC options in VENSIM, but I have several questions and hopefully, I can get some help here:

1.- How to input priors?
I just don't see where I can specify the distribution of my priors. I am supposing that, by using the search limits in the optimization options window, I can at least specify the extremes of my prior (is that right?) But, that is assuming a uniform distribution of my prior. So, how can I declare a more informed prior?

2.- Log-Likelihood function
So far, I am using as payoff objective the maximization of a total log-likelihood function between my Observed and Simulated data. That total log-likelihood is calculated by calculating the LL at every timestep with LL= exp(-(LN(Observed)-LN(Simulated))^2/(2*sigma^2)) and then multiplying all of those LL together. I am not sure if this is necessary or if, just by specifying in the Payoff definition to calibrate between my observed and simulated data, VENSIM will calculate the LL automatically.

3.-Diagnostics
The "MCMC Output" page from the VENSIM documentation shows a graph with convergence diagnostics (see below). How can I obtain that graph? I understand that I have to import the .dat file as .vdfx into the model, but then what? I can't find a way to generate those diagnostics

Image

4.- log window while running.
The log output while the MCMC is running shows some diagnostics and, while I do understand most of them in theory, I am not sure the nomenclature that VENSIM is using. For example, the MAX PSRF shows 0.4525, 11/11, <1.2 ; I am not sure what the 11/11<1.2 represents. do you have some literature recommendations to understand all of this?

5.- MCMC algorithm.
I have a person that is a bit more knowledgeable about MCMC that is helping me out, and they are asking me about the specific MCMC algorithm that VENSIM uses. I am pasting their specific questions:
--> Find out exactly what algorithm Vensim is using for MCMC. Especially, what it assumes about the objective function. Eg, the one in R assumes you give it the numerator of Bayes formula: P(q | data) ~ P(q)*P(data | q)
-->It would be helpful to know whether the MCMC function expects a posterior or log-posterior as well.
Sorry for such a long message but I really hope you can help me out with this.

Thanks
rodrigo?solis
Member
Posts: 22
Joined: Mon Jan 21, 2019 11:41 pm
Vensim version: DSS

Re: Use of MCMC

Post by rodrigo?solis »

Hi, hopefully, someone can answer this question soon
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Use of MCMC

Post by tomfid »

Sorry - requires some thought and I've been ultra busy.

1. This is not automated yet, so you have to create an equation to express your prior. Here's an example. Suppose I have a policy effect parameter. If you don't know what its value could be, just that it's >0, you could use the improper log-uniform prior:
policy prior = -LN(policy effect)
if you have some prior expectation about the effect, you might use:
policy prior = -((policy effect - prior effect)/prior SD)^2/2
This is the normal likelihood (excluding terms that are invariant).

For efficiency, make the above items Initial() equations.

Then add "policy prior" to the payoff as a Policy item, with timing Initial or Final, no transform, weight=1.

2. If you use the Calibration payoff options, it'll compute log likelihoods for you. However, it is kind of nice to have the structure of the computation explicitly in the model, so you can peek inside.

Remember that likelihoods multiply together, but log likelihoods sum.

3. This is a little clunky at present. You can open the vdfx (or any vdf) as a model. Use File>Open and change the type to .vdf. Then you get a blank sketch, but you're actually in a model containing all the variables in the vdf. Use the Control Panel>Variables tab to access the contents and generate plots.
rodrigo?solis
Member
Posts: 22
Joined: Mon Jan 21, 2019 11:41 pm
Vensim version: DSS

Re: Use of MCMC

Post by rodrigo?solis »

Thanks a lot for your answer Tom, and no worries at all about the delay! I really appreciate your response.

Based on your reply here and the Weibull model that you replied in this thread viewtopic.php?f=2&t=5428&p=20730&hilit=mcmc#p20730, I added a new view to my model with my 6 priors (5 Normal and one Log-Normally distributed).

Then I created "Total LL" by adding those priors and the "Data LL" (between the observed data (real report) and the simulated data (report)).

I set the payoff to Maximize "Total LL" and left the settings of the Voc file as default.

I am running the model right now but I am quite uncertain that I set it up properly.

No rush but, whenever you have time, could you take a look at how I declared the priors and set up everything, please?

Thanks in advance
Attachments
Model.zip
(1.29 MiB) Downloaded 159 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Use of MCMC

Post by tomfid »

Will look when I can. Your description sounds right though. Just watch out for missing minus signs - easy mistake to make.
rodrigo?solis
Member
Posts: 22
Joined: Mon Jan 21, 2019 11:41 pm
Vensim version: DSS

Re: Use of MCMC

Post by rodrigo?solis »

Excellent. thank you so much. I am looking forward to your input. Meanwhile, I'll run it as is and will share my posteriors once it is done. Thanks!
Post Reply