# Calibrate Shock in Bayesian Estimation

**URL:** <https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601>\
**Category:** ML/Bayesian estimation\
**Created:** [24 June 2022 21:32 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601 "2022-06-24T21:32:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David5](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@David5](https://forum.dynare.org/u/David5)\
**Post date:** [24 June 2022 21:32 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/1 "2022-06-24T21:32:16Z")

</div>

Dear all,  
I have to compare Bayesian IRFs with different models for a monetary policy shock.  
Thus, to make it comparable, the shock size across all models should be the same.  
I have removed rhoM from estimated\_params, so that the MP shock will be calibrated since I have rhoM = 0.5 as a parameter calibrated.  
However, I get the error message:

Error using chol  
Matrix must be positive definite. (…)

Could someone give me a hint, where the mistake is and how I can set the MP shock to be equal across all models?

Thank you !

---

<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:** [26 June 2022 07:57 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/2 "2022-06-26T07:57:33Z")

</div>

1. Usually you should estimate the model without such restrictions if they are just there for comparability.
2. You can use the `relative_irf`- option to generate IRFs to a 1percent shock in all models and then rescale these IRFs.

---

<div class="post-metadata">

**Author:** ![David5](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@David5](https://forum.dynare.org/u/David5)\
**Post date:** [26 June 2022 12:40 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/3 "2022-06-26T12:40:21Z")

</div>

Hello Prof. Pfeifer,

so you would suggest not to equalize the shock size but to estimate the shock, so that the shock across all models is 1 stderr and compare models of a shock of 1 stderr?  
I would like to do it that way, but I don’t understand, how the models are comparable since in the Bayesian Irfs one model is hit by a r=0.129006 shock and in another model the economy is hit by a r=0.1899 shock.  
Then the irfs of the other variables differ since there is a discripancy in the shocks.

Could you clarify the misunderstanding?

Thanks !

---

<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:** [26 June 2022 15:57 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/4 "2022-06-26T15:57:33Z")

</div>

What the `relative_irf`-option will do is provide the IRFs to a 1 percent shock instead of a one standard deviation shock. That solves the comparability issue.

---

<div class="post-metadata">

**Author:** ![David5](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@David5](https://forum.dynare.org/u/David5)\
**Post date:** [27 June 2022 21:55 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/5 "2022-06-27T21:55:15Z")

</div>

Hello Prof. Pfeifer,

I have followed the steps suggested in a previous post:

> [@Dynare relative irf](https://forum.dynare.org/t/dynare-relative-irf/1908/2):
>
> The respective Dynare code for this option used in stoch\_simul.m is
> 
> ` if options_.relative_irf y = 100*y/cs(i,i); end`

in my case, given that I have a log linearized version and no stoch\_simul command  
I have added after the estimation command

```auto
if options_.relative_irf 
exp(y)=exp(100*y/cs(i,i)) 
exp(pinf)=exp(100*pinf/cs(i,i)) 
exp(r)=exp(100*r/cs(i,i));
end;

```

However, I was not successful with it. Could you give me an advice?

Many thanks !

---

<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:** [28 June 2022 07:54 UTC](https://forum.dynare.org/t/calibrate-shock-in-bayesian-estimation/20601/6 "2022-06-28T07:54:46Z")

</div>

Why don’t you set `options_.relative_irf=1` before estimation?
