# Gertler and Karadi dynare simulation

**URL:** <https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777>\
**Category:** Stochastic simulations\
**Created:** [14 November 2018 11:06 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777 "2018-11-14T11:06:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiolapedulla](https://forum.dynare.org/letter_avatar_proxy/v4/letter/f/53a042/32.png) [@fabiolapedulla](https://forum.dynare.org/u/fabiolapedulla)\
**Post date:** [14 November 2018 11:06 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/1 "2018-11-14T11:06:33Z")

</div>

Hey guys!  
I am writing a dynare code following Gertler and Karadi’s paper “A model of unconventional monetary policy”. I want to introduce a credit policy shock but the code cannot run!  
The problem is:  
"Error: File: GK\_creditpolicy2018.m Line: 416 Column: 18  
Unexpected MATLAB expression.

Error in dynare (line 223)  
evalin(‘base’,fname) ;"  
[GK\_creditpolicy2018.mod](https://forum.dynare.org/uploads/default/original/2X/1/1b8c2869c45fccdb0f47ca28c3a8a1721f74a20c.mod) (9.8 KB)

I cannot find the errors! Would anyone help me?  
I post the code here…  
Thank you in advance!

---

<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:** [14 November 2018 11:32 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/2 "2018-11-14T11:32:38Z")

</div>

```auto
title('Household's consumption')

```

needs to be

```auto
title('Household''s consumption')

```

to be recognized as a string in Matlab

---

<div class="post-metadata">

**Author:** ![fabiolapedulla](https://forum.dynare.org/letter_avatar_proxy/v4/letter/f/53a042/32.png) [@fabiolapedulla](https://forum.dynare.org/u/fabiolapedulla)\
**Post date:** [14 November 2018 11:53 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/3 "2018-11-14T11:53:10Z")

</div>

Thank you professor! Now the error is:

**"Error using print\_info (line 83)**  
**Impossible to find the steady state. Either the model doesn’t have a steady state, there are an infinity of**  
**steady states, or the guess values are too far from the solution**

**Error in check (line 76)**  
\*\* print\_info(info, 0, options);\*\*

**Error in GK\_creditpolicy2018 (line 386)**  
**oo\_.dr.eigval = check(M\_,options\_,oo\_);**

**Error in dynare (line 223)**  
**evalin(‘base’,fname) ;"**

What is wrong in your opinion? Thanks for the attention!

---

<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:** [14 November 2018 13:48 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/4 "2018-11-14T13:48:59Z")

</div>

You need to find out why your changes imply that the steady state cannot be found.

---

<div class="post-metadata">

**Author:** ![fabiolapedulla](https://forum.dynare.org/letter_avatar_proxy/v4/letter/f/53a042/32.png) [@fabiolapedulla](https://forum.dynare.org/u/fabiolapedulla)\
**Post date:** [19 November 2018 14:47 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/5 "2018-11-19T14:47:22Z")

</div>

Thank you professor!  
Now I changed some equations and I added the initval block!  
The error now is:  
"Error using print\_info (line 37)  
The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function  
dgges: info=28, n=26. You can also run model\_diagnostics to get more information on what may cause this problem.

Error in check (line 76)  
print\_info(info, 0, options);

Error in PROVA (line 491)  
oo\_.dr.eigval = check(M\_,options\_,oo\_);

Error in dynare (line 223)  
evalin(‘base’,fname) ; "

What is wrong now? I post, as usually, the code…[PROVA.mod](https://forum.dynare.org/uploads/default/original/2X/d/d72b96dc207a0ab9e552e0e1c6b194dd58c2872c.mod) (10.7 KB)

---

<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 November 2018 17:43 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/6 "2018-11-19T17:43:37Z")

</div>

`model_diagnostics` returns

```auto
MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 1 colinear relationships between the variables and the equations
Colinear variables:
psi     
Colinear equations
    32 36

```

The equation

```auto
psi = psi+kap*(Rk(+1)-R-SPRSS)+shockpsi;

```

is strange, because it implies

```auto
0 = kap*(Rk(+1)-R-SPRSS)+shockpsi;

```

i.e. the `psi` drops out.

---

<div class="post-metadata">

**Author:** ![fabiolapedulla](https://forum.dynare.org/letter_avatar_proxy/v4/letter/f/53a042/32.png) [@fabiolapedulla](https://forum.dynare.org/u/fabiolapedulla)\
**Post date:** [17 December 2018 13:22 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/7 "2018-12-17T13:22:09Z")

</div>

Hi everyone! I’m still working on Gertler and Karadi paper…  
Now I’m trying to study this model with EU calibration. Now I have a problem: the residual of equation 21 is not zero and I don’t understand why.  
I attach the code here…Could anyone help me?  
Thank you in advance[GK18EU.mod](https://forum.dynare.org/uploads/default/original/2X/e/e92d42fbfd1eee0952d1ace59b8e866ff7f9588f.mod) (10.2 KB)

---

<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:** [18 December 2018 13:56 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/8 "2018-12-18T13:56:17Z")

</div>

```auto
gov = 0.215; % government spending over GDP

```

seems to be inconsistent with

```auto
GSS = 0.38; % ... government spending

```

---

<div class="post-metadata">

**Author:** ![Bandel](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/6de8d8/32.png) [@Bandel](https://forum.dynare.org/u/Bandel)\
**Post date:** [14 November 2024 14:09 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/9 "2024-11-14T14:09:42Z")

</div>

[modell1.mod](https://forum.dynare.org/uploads/short-url/7wVG58Nbb3cm7FRJPD3wnm6UMgj.mod) (7.6 KB)

Dear Professor, I meet the same error, please help me check it. Thanks a lot.

---

<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:** [15 November 2024 10:15 UTC](https://forum.dynare.org/t/gertler-and-karadi-dynare-simulation/12777/10 "2024-11-15T10:15:32Z")

</div>

I can only give you the generic advice. Check your model setup and potentially work your way up from a simpler version that works.
