# Bayesian estimation with MCMC

**URL:** <https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055>\
**Category:** Dynare help (legacy posts)\
**Created:** [16 October 2015 23:28 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055 "2015-10-16T23:28:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanking](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/8baadc/32.png) [@yanking](https://forum.dynare.org/u/yanking)\
**Post date:** [16 October 2015 23:28 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055/1 "2015-10-16T23:28:37Z")

</div>

Dear all,  
I am trying to do Bayesian estimation with MCMC,Estimation seems to work properly,However, the Estimation:mcmc:diagnostics:does not work and returns an error  
Estimation::mcmc::diagnostics: Univariate convergence diagnostic, Brooks and Gelman (1998):  
Parameter 1… ??? Attempted to access temp(-6298,1); index must be a positive integer or  
logical.

Error in ==\> McMCDiagnostics\_core at 105  
UDIAG(ligne,1,j-fpar+1) = temp(CSUP,1)-temp(CINF,1);

Error in ==\> McMCDiagnostics at 173  
fout = McMCDiagnostics\_core(localVars,1,npar,0);

Error in ==\> dynare\_estimation\_1 at 793  
oo\_= McMCDiagnostics(options\_, estim\_params\_, M\_,oo\_);

Error in ==\> dynare\_estimation at 89  
dynare\_estimation\_1(var\_list,dname);

Error in ==\> estimatingfinal at 1014  
dynare\_estimation(var\_list\_);

Error in ==\> dynare at 180  
evalin(‘base’,fname) ;

Thank you so much!

---

<div class="post-metadata">

**Author:** ![yanking](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/8baadc/32.png) [@yanking](https://forum.dynare.org/u/yanking)\
**Post date:** [16 October 2015 23:32 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055/2 "2015-10-16T23:32:09Z")

</div>

I would very much appreciate if anyone could help with this matter.

---

<div class="post-metadata">

**Author:** ![yanking](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/8baadc/32.png) [@yanking](https://forum.dynare.org/u/yanking)\
**Post date:** [16 October 2015 23:35 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055/3 "2015-10-16T23:35:25Z")

</div>

dear all,  
I am having a hard time to work with modle file in matlab. Can someone tell me what I am doing wrong here.  
Thank you for any help or suggestion!

---

<div class="post-metadata">

**Author:** ![yanking](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/8baadc/32.png) [@yanking](https://forum.dynare.org/u/yanking)\
**Post date:** [16 October 2015 23:38 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055/4 "2015-10-16T23:38:43Z")

</div>

Dear all,  
I am trying to do Bayesian estimation with MCMC.However, the Estimation:mcmc:diagnostics:does not work and returns an error, Can someone tell me what I am doing wrong here.  
Thank you for any help or suggestion!  
Estimation::mcmc::diagnostics: Univariate convergence diagnostic, Brooks and Gelman (1998):  
Parameter 1… ??? Attempted to access temp(-6298,1); index must be a positive integer or  
logical.

Error in ==\> McMCDiagnostics\_core at 105  
UDIAG(ligne,1,j-fpar+1) = temp(CSUP,1)-temp(CINF,1);

Error in ==\> McMCDiagnostics at 173  
fout = McMCDiagnostics\_core(localVars,1,npar,0);

Error in ==\> dynare\_estimation\_1 at 793  
oo\_= McMCDiagnostics(options\_, estim\_params\_, M\_,oo\_);

Error in ==\> dynare\_estimation at 89  
dynare\_estimation\_1(var\_list,dname);

Error in ==\> estimatingfinal at 1014  
dynare\_estimation(var\_list\_);

Error in ==\> dynare at 180  
evalin(‘base’,fname) ;

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [17 October 2015 06:55 UTC](https://forum.dynare.org/t/bayesian-estimation-with-mcmc/5055/5 "2015-10-17T06:55:43Z")

</div>

Please provide the files to replicate the issue and state which Dynare version has been used.
