# Error in computing likelihood for initial parameter values

**URL:** <https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484>\
**Category:** Dynare help (legacy posts)\
**Created:** [2 June 2010 07:47 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484 "2010-06-02T07:47:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dean0504](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@dean0504](https://forum.dynare.org/u/dean0504)\
**Post date:** [2 June 2010 07:47 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/1 "2010-06-02T07:47:36Z")

</div>

hey,guys.I update my question asked last week here.When I estimated a BGG model with heterogeneous firms,dynare warned me that  
Error in computing likelihood for initial parameter values  
??? Error using ==\> print\_info  
Blanchard Kahn conditions are not satisfied: indeterminacy  
Error in ==\> initial\_estimation\_checks at 87  
print\_info(info)  
Error in ==\> dynare\_estimation\_1 at 320  
initial\_estimation\_checks(xparam1,gend,data);  
Error in ==\> dynare\_estimation at 62  
dynare\_estimation\_1(var\_list,varargin{:});  
Error in ==\> bbgg at 324  
dynare\_estimation(var\_list\_);  
Error in ==\> dynare at 102  
evalin(‘base’,fname) ;

Is this mean that the prior means of the paremeters I choosed are not proper for the model? So what should I do next? Thank you for your help.I attached my codes and data file here.  
[try1.xls](https://forum.dynare.org/uploads/default/original/1X/dc76a4f34479218a9de9c0bea1a7df475f831caf.xls) (15 KB)  
[bbgg.mod](https://forum.dynare.org/uploads/default/original/1X/560e1da04bc131eaacd3166198cc0788c98ca88f.mod) (3.38 KB)

---

<div class="post-metadata">

**Author:** ![coot](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@coot](https://forum.dynare.org/u/coot)\
**Post date:** [3 June 2010 13:48 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/2 "2010-06-03T13:48:16Z")

</div>

try using estimated\_param\_init to define the start for estimation… try specifing other values that mean of priors.

---

<div class="post-metadata">

**Author:** ![coot](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@coot](https://forum.dynare.org/u/coot)\
**Post date:** [3 June 2010 14:13 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/3 "2010-06-03T14:13:04Z")

</div>

the prior means do not satify blanchard kahn condition… try finding a set of parameters that do… you also misstyped at priors nu1 twice… check it… there are some parameters you dont use in model, like sig\_g or sig\_a… also the prior for

`sig_r,inv_gamma_pdf,0.01,inf;` is not good if you specifiy first that sig\_r=2.01… probably the value 0.01 is not good for steady state… try

```auto

```

also pecify sheet name and rage when reading from excel…

try reading data from mat file

---

<div class="post-metadata">

**Author:** ![dean0504](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@dean0504](https://forum.dynare.org/u/dean0504)\
**Post date:** [4 June 2010 01:22 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/4 "2010-06-04T01:22:06Z")

</div>

Hi,coot!Thank you for your help!I think the programe has improved after I corrected my typo that you mentioned and change the std of rn to 2.01.But there is a new problem,dynare told me that  
??? Error using ==\> DiffuseLikelihood1  
The variance of the forecast error remains singular until theend of the sample

Error in ==\> DsgeLikelihood at 305  
LIK = DiffuseLikelihood1(T,R,Q,Pinf,Pstar,data,trend,start);

Error in ==\> initial\_estimation\_checks at 58  
[fval,cost\_flag,ys,trend\_coeff,info] = DsgeLikelihood(xparam1,gend,data);

Error in ==\> dynare\_estimation\_1 at 320  
initial\_estimation\_checks(xparam1,gend,data);

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

Error in ==\> bbgg at 318  
dynare\_estimation(var\_list\_);

Error in ==\> dynare at 102  
evalin(‘base’,fname) ;  
Does this mean that there is something wrong with my data? The data is stationary [however.So](http://however.So) what should I do next?Thanks for hlep

---

<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:** [4 June 2010 06:53 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/5 "2010-06-04T06:53:47Z")

</div>

You also did not specify shock variances as there is no shocks-statement. The attached version runs for me. Note that the standard errors are arbitrarily set.  
[bbgg.mod](https://forum.dynare.org/uploads/default/original/1X/de8e9a6fcffddf414ec9e62025a09233aa214d34.mod) (3.72 KB)

---

<div class="post-metadata">

**Author:** ![dean0504](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@dean0504](https://forum.dynare.org/u/dean0504)\
**Post date:** [10 June 2010 07:36 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/6 "2010-06-10T07:36:04Z")

</div>

Thanks very much for the help,now the code can run successfully.But when I run the code ,sometimes it can give me the estimated result,but sometimes it warned me that  
??? Error using ==\> chol  
Matrix must be positive definite.  
Error in ==\> gmhmaxlik at 100  
dd = transpose(chol(CovJump));  
Error in ==\> dynare\_estimation\_1 at 484  
[xparam1,PostVar,Scale,PostMean] = …  
Error in ==\> dynare\_estimation at 62  
dynare\_estimation\_1(var\_list,varargin{:});  
Error in ==\> bbgg1 at 335  
dynare\_estimation(var\_list\_);  
Error in ==\> dynare at 102  
evalin(‘base’,fname) ;  
Why does this happen?And what should I do ? Thank you very much.

---

<div class="post-metadata">

**Author:** ![coot](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@coot](https://forum.dynare.org/u/coot)\
**Post date:** [12 June 2010 03:32 UTC](https://forum.dynare.org/t/error-in-computing-likelihood-for-initial-parameter-values/1484/7 "2010-06-12T03:32:26Z")

</div>

try searching for your error on the forum… it is explained… some time optimization routines do not get the results… it happens just sometimes because as I understood there is some randomness involved in optimization routiness… if you want not to get it try using mode\_compute=6 in your estimation but note that this is not an optimization routine or a very inefficient one… read dynare wiki for mode\_compute=6 and search the forum for your error related to chol
