# Likelihood only!

**URL:** <https://forum.dynare.org/t/likelihood-only/3850>\
**Category:** ML/Bayesian estimation\
**Created:** [15 April 2014 15:56 UTC](https://forum.dynare.org/t/likelihood-only/3850 "2014-04-15T15:56:42Z")\
**Posts on this page:** 11\
**Page:** 3

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [22 September 2014 07:56 UTC](https://forum.dynare.org/t/likelihood-only/3850/41 "2014-09-22T07:56:47Z")

</div>

I entered it like this

estimation(order=1, datafile=usmodel\_data\_eget, mh\_replic=10, mh\_nblocks=2, mh\_jscale=0.8,  
use\_univariate\_filters\_if\_singularity\_is\_detected=0, nograph, nodiagnostic);

It seems like that did the trick. The extremly high likelihood values now got the error value instead i.e -1e+8.

Nice work!!

\Glm

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [6 October 2014 16:04 UTC](https://forum.dynare.org/t/likelihood-only/3850/42 "2014-10-06T16:04:25Z")

</div>

I am trying to do do the exact same thing as earlier, i.e. running the mod-file with the purpose of getting the likelihood value only. The difference this time is that instead of a pure Maximum likelihood I’ve added the same priors as Smets and Wouters (2007). But now the usual way doesn’t seem to work at all. Is there a way to fix this? I’ve attached both files, the usual maximum likelihood mod-file called “s\_and\_w\_ml.mod” and the one with priors “s\_and\_w\_prior.mod”

\\Glm  
[Replicate Smets and Wouters (2007).zip](https://forum.dynare.org/uploads/default/original/2X/e/ed7bc9fd3ec472a62ca6b9d64fc625fc557841c8.zip) (18 KB)

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [7 October 2014 06:25 UTC](https://forum.dynare.org/t/likelihood-only/3850/43 "2014-10-07T06:25:52Z")

</div>

I forgot to add one file, “min\_max\_funk”. It’s added here.

\\Glm  
[min\_max\_funk.m](https://forum.dynare.org/uploads/default/original/2X/6/68596f59a73a91001e512d858d715e4b9adc7847.m) (363 Bytes)

---

<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:** [9 October 2014 05:16 UTC](https://forum.dynare.org/t/likelihood-only/3850/44 "2014-10-09T05:16:09Z")

</div>

What exactly is the problem?

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [9 October 2014 07:50 UTC](https://forum.dynare.org/t/likelihood-only/3850/45 "2014-10-09T07:50:32Z")

</div>

I wanna get the likelihood value for some paramater vector “xparam”. This works fine when I have a 100 % maximum likelihood mod file. But when I add priors, for instance if I replace the first row of the “estimated\_params” block like this (in the s\_and\_w\_ml.mod file):

csadjcost,6.3325,tres(1,1),tres(1,2);

and replace it with the prior

csadjcost,6.3325,2,15,NORMAL\_PDF,4,1.5;

It doesn’t work any more and I get the error that it can’t find the distribution “NORMAL\_PDF”

---

<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:** [9 October 2014 09:58 UTC](https://forum.dynare.org/t/likelihood-only/3850/46 "2014-10-09T09:58:03Z")

</div>

You cannot have a mixture. You must either go full ML or full Bayesian. Everything in between will crash.

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [9 October 2014 10:11 UTC](https://forum.dynare.org/t/likelihood-only/3850/47 "2014-10-09T10:11:57Z")

</div>

Oki. But I also tried a full Bayesian where I put priors on all parameters (that’s the only difference between “s\_and\_w\_ml.mod” and “s\_and\_w\_prior.mod”). Although it doesn’t work the same way that “s\_and\_w\_ml.mod” does, that is, allows me to evaluate the likelihood value only for a given parameter vector.

---

<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:** [9 October 2014 12:12 UTC](https://forum.dynare.org/t/likelihood-only/3850/48 "2014-10-09T12:12:56Z")

</div>

Then provide the final file that does not work.

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [14 October 2014 15:54 UTC](https://forum.dynare.org/t/likelihood-only/3850/49 "2014-10-14T15:54:38Z")

</div>

No worries, I found the problem myself. Some of the parameters were outside of the prior bounds which in turn generated the error log likelihood -1e+8.

But thanks anyways for all your help!

\\Glm

---

<div class="post-metadata">

**Author:** ![Glm](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/b19c9b/32.png) [@Glm](https://forum.dynare.org/u/Glm)\
**Post date:** [18 October 2014 16:52 UTC](https://forum.dynare.org/t/likelihood-only/3850/50 "2014-10-18T16:52:25Z")

</div>

If i write like this in the parameter block

constebeta=0.16;  
cbeta=1/(1+constebeta/100);

and like this in the model block

x_cbeta=gamma+y_zeta;

will Dynare take into account that cbeta is a function of constebeta when I estimate with regard to constebeta?

\\Glm

---

<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:** [19 October 2014 09:10 UTC](https://forum.dynare.org/t/likelihood-only/3850/51 "2014-10-19T09:10:43Z")

</div>

Calibration only once updates the other parameters depending on the estimated one. That’s why you should use model-local variables (the ones with the pound operator) or a steady state file. See Remark 4 (Parameter dependence and the use of model-local variables) in [Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”](https://drive.google.com/file/d/1r89OU5OE3CBa6tOlj6l3hNVWEaRH5Anv/view?usp=sharing).

[Previous page](https://forum.dynare.org/t/likelihood-only/3850.md?page=2)
