# BETAINV did not converge

**URL:** <https://forum.dynare.org/t/betainv-did-not-converge/2105>\
**Category:** Dynare help (legacy posts)\
**Created:** [16 August 2011 17:12 UTC](https://forum.dynare.org/t/betainv-did-not-converge/2105 "2011-08-16T17:12:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![llagalo](https://forum.dynare.org/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@llagalo](https://forum.dynare.org/u/llagalo)\
**Post date:** [16 August 2011 17:12 UTC](https://forum.dynare.org/t/betainv-did-not-converge/2105/1 "2011-08-16T17:12:42Z")

</div>

I am completely new to Dynare so I am having a few troubles using it. I am getting the following errors:

You did not declare endogenous variables after the estimation command.  
Warning: BETAINV did not converge for a = 23.5125, b = 0.2375, p = 0.999.

> In betainv at 109  
> In draw\_prior\_density at 47  
> In plot\_priors at 101  
> In dynare\_estimation\_init at 125  
> In dynare\_estimation\_1 at 37  
> In dynare\_estimation at 62  
> In herrera1a at 387  
> In dynare at 132  
> Warning: BETAINV did not converge for a = 23.5125, b = 0.2375, p = 1.  
> In betainv at 109  
> In prior\_bounds at 50  
> In dynare\_estimation\_init at 128  
> In dynare\_estimation\_1 at 37  
> In dynare\_estimation at 62  
> In herrera1a at 387  
> In dynare at 132  
> ??? Error using ==\> eval  
> Undefined function or variable ‘simudata’.

Error in ==\> read\_variables at 50  
eval(dyn\_instr\_01);

Error in ==\> dynare\_estimation\_init at 286  
rawdata = read\_variables(options\_.datafile,options\_.varobs,],options\_.xls\_sheet,options\_.xls\_range);

Error in ==\> dynare\_estimation\_1 at 37  
[data,rawdata,xparam1] = dynare\_estimation\_init(var\_list\_);

Error in ==\> dynare\_estimation at 62  
dynare\_estimation\_1(var\_list,varargin{:});

Error in ==\> herrera1a at 387  
dynare\_estimation(var\_list\_);

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

Why am I getting all these errors?

---

<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 August 2011 07:13 UTC](https://forum.dynare.org/t/betainv-did-not-converge/2105/2 "2011-08-17T07:13:40Z")

</div>

For starters ignore the first warnings. They are not errors. Apparently, there is a problem with some beta priors like mean and standard deviation are inconsistent. The true problem is your combination of the varobs command and your data-file. However, without the mod- and the data-file it is impossible to tell what is going on.

---

<div class="post-metadata">

**Author:** ![llagalo](https://forum.dynare.org/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@llagalo](https://forum.dynare.org/u/llagalo)\
**Post date:** [17 August 2011 10:02 UTC](https://forum.dynare.org/t/betainv-did-not-converge/2105/3 "2011-08-17T10:02:31Z")

</div>

Thank you.now the error that I am getting says:  
POSTERIOR KERNEL OPTIMIZATION PROBLEM!  
(minus) the hessian matrix at the “mode” is not positive definite!  
=\> posterior variance of the estimated parameters are not positive.  
You should try to change the initial values of the parameters using  
the estimated\_params\_init block, or use another optimization routine.  
Warning: The results below are most likely wrong!

> In dynare\_estimation\_1 at 436  
> In dynare\_estimation at 62  
> In herrera1a at 377  
> In dynare at 132

RESULTS FROM POSTERIOR MAXIMIZATION  
parameters  
prior mean mode s.d. t-stat prior pstdev

beta 0.990 1.0000 0.0000 0.0000 beta 0.0200  
lambda 1.005 1.0048 0.0200 50.1983 norm 0.0200  
phi\_y 0.330 0.3258 0.0200 16.3133 norm 0.0200  
nu\_y 1.500 1.5066 0.0189 79.7143 norm 0.0200  
chi\_y 0.100 0.0983 0.0199 4.9308 norm 0.0200  
nu\_z 1.500 1.5003 0.0199 75.3943 norm 0.0200  
chi\_z 0.100 0.0999 0.0200 5.0021 norm 0.0200  
eta 2.000 2.0005 0.0200 100.0699 norm 0.0200  
gam\_y 0.900 0.9006 0.0200 45.0159 norm 0.0200  
gam\_z 0.900 0.9000 0.0200 45.0015 norm 0.0200  
rho\_r 0.900 0.7904 0.0117 67.6765 norm 0.0200  
phi\_pi 2.150 2.1581 0.0201 107.5753 norm 0.0200  
phi\_s 0.500 0.5148 0.0195 26.4355 norm 0.0200  
eta\_y 0.750 0.7500 0.0200 37.5004 norm 0.0200  
eta\_z 0.750 0.7500 0.0200 37.5004 norm 0.0200  
rho\_p 0.900 0.9003 0.0203 44.4508 beta 0.0200  
rho\_q 0.900 0.9002 0.0204 44.0847 beta 0.0200  
phi\_p 0.500 0.5000 0.0200 24.9401 beta 0.0200  
phi\_q 0.500 0.5000 0.0200 24.9401 beta 0.0200  
rho\_y 0.950 0.9257 0.0163 56.6648 beta 0.0200  
rho\_z 0.950 0.9511 0.0193 49.3725 beta 0.0200  
rho\_g 0.900 0.9012 0.0202 44.5179 beta 0.0200  
rho\_xi 0.900 0.8657 0.0078 110.9319 beta 0.0200  
rho\_er 0.900 0.8115 0.0373 21.7486 beta 0.0200

Log data density [Laplace approximation] is -2320.328786.

Warning: BETAINV did not converge for a = 23.5125, b = 0.2375, p = 1.

> In betainv at 109  
> In prior\_bounds at 50  
> In dynare\_estimation\_1 at 852  
> In dynare\_estimation at 62  
> In herrera1a at 377  
> In dynare at 132  
> ??? Error using ==\> chol  
> Matrix must be positive definite.

Error in ==\> metropolis\_hastings\_initialization at 52  
d = chol(vv);

Error in ==\> random\_walk\_metropolis\_hastings at 58  
ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar, nblck, nruns, NewFile, MAX\_nruns, d ] = …

Error in ==\> dynare\_estimation\_1 at 871  
feval(options\_.posterior\_sampling\_method,‘DsgeLikelihood’,options\_.proposal\_distribution,xparam1,invhess,bounds,gend,data,…

Error in ==\> dynare\_estimation at 62  
dynare\_estimation\_1(var\_list,varargin{:});

Error in ==\> herrera1a at 377  
dynare\_estimation(var\_list\_);

Error in ==\> dynare at 132  
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 August 2011 10:46 UTC](https://forum.dynare.org/t/betainv-did-not-converge/2105/4 "2011-08-17T10:46:09Z")

</div>

Please search the forum, this is one of the most common threads. A short answer is: Try using mode\_compute=6 in the estimation command.
