Simplest NK model with capital (nonlinear)

Dear Dynare Team,

I am very new to dynare, so I apologize for my question being basic.
I tried to write down the simplest possible NK model with capital.
Even when I start extremely close to the steady state, I get a warning
“Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.614805e-19.”
trysimplest.mod (3.1 KB)

And the steady state can’t be computed.
Any hint on what I am doing wrong would be appreciated.
Thank you very much and many greetings

Often this means there is still an issue in the model. Here, I find it curious that the “Government debt rule” shows a residual given your initial values.

Dear Professor Pfeifer,

thank you very much for your fast help.
Indeed, the target values were not set consistently, which I fixed.
Now I am getting an error saying “Blanchard & Kahn conditions are not satisfied: no stable equilibrium.”.
trysimplest.mod (3.1 KB)

If I were to write down a redundant equation but forget another one, would dynare be able to tell me?

Thank you very much and many greetings.

I should add:
if I remove the government debt rule (16) and keep B = Btarget exogenously, it seems to run fine (see
trysimplest_Bexogenous.mod (3.2 KB)
I hence suspect the problem must be with the debt rule.
Many greetings.

This usually indicates your debt feedback was insufficient or too strong to stabilize debt.

Dear Professor Pfeifer,
thank you for your help.
I think I have a better understanding now, I post what I found in case someone will find this thread in the future.
there were two problems:

  1. The timing in the “Government debt rule (16)” was shifted by 1.
  2. There seems to be a problem with the feedback of taxes on the government debt.
    Since, in this model, the taxes are uniquely pinned down by the debt policy, maybe this feedback cant work, I have to think about it more.

If I fix the timing and remove the tax level from the government debt rule, it seems to work fine.
(For reference, see
trysimplest.mod (3.1 KB)

Thank you very much and many greetings

Dear all,
while I am meanwhile more or less hopeful that the model is solved correctly, I find the impulse responses to the monetary shock a bit hard to wrap my head around.
I am suspecting it may be looking weird because capital is predetermined and I don’t have adjustment costs (so in impact labor supply jumps a lot and then very little afterward, looks totally different to the case without capital).
To compare, I am looking for a very simple example of an NK model with capital.

If anybody has a recommendation (preferably with dynare code available) I would be grateful.

Thank you very much and many greetings =)

is essentially such a model as is the NK_baseline.mod shipped as an example in Dynare.

Dear Professor Pfeifer,
thank you very much for your help!

Dear Professor Pfeifer,

I apologize for asking again.
I did compare my try to the two models, but they do have substantially more moving parts and I am unable to boil down the differences.
Since the model I am trying is so simple, I am wondering if it is possible for someone more experienced to “see” if the impulse response functions it generates to a monetary policy shock are reasonable.

What throws me off is the very strong reaction on impact.
Did anybody else experience this?
Is this the reason most DSGE models have many bells and whistles?
Capital and consumption react smoothly and in a way, which looks similar to other models (as the models mentioned above).
Inflation and labor supply, however, react totally differently and super strongly on impact.

Any help and advice would be appreciated.
Many greetings and a great day to everyone =)
trysimplest_Bexog.mod (2.6 KB)

I am unable to run your code due to Btarget being undefined.

Dear Professor Pfeifer,
I sincerely apologize, this was very stupid of me.
I fixed it now and attach the corrected version (I assume the bond is in zero net supply so I took it out of the equations to simplify things ).
trysimplest_Bexog.mod (2.6 KB)

Any help on if the IRFs look reasonable would be greatly appreciated,
Thank you very much and many greetings

There is nothing too unusual here. Your shock is a one-time one without persistence. It is well-known that in most rational expectations models most endogenous variables inherit the persistence of the exogenous process. That is the reason we add so many bells and whistles: to increase endogenous propagation.

Dear Professor Pfeifer,

thank you very much for your help and reply.
I thought the shock has persistence in the sense that in the Taylor rule rhoi = 0.8 and hence i will remain at a higher level after the initial shock.
Am I misunderstanding something?
In the impulse responses i, C and K show persistent deviations but the ones from N, w and mc for example not.
Do you have an intuition or a reference, why that is?

Thank you very much for your enormous help and many greetings

The interest smoothing indeed gives you some persistence. It is visible in the reaction of the the real interest rate and other variables after period 1. They take quite some time to go back to steady state. But you can see that this effect is relatively small, which comes from the effect of the MP shock on the interest rate being rather modest. Its increase is smaller by one order of magnitude than the impact response of most variables. i goes up persistently due to interest smoothing. The persistent response of consumption and capital come from the consumption smoothing motive of households and capital being the only saving device. That is well-known from the RBC model. In contrast, N and w result from essentially static optimization problems. There is not much going on after period 1

Dear Professor Pfeifer,

thank you very much for your detailed explanation!
This is exactly what I needed to understand.
Thank you very much and have a great weekend =)

Dear Professor Pfeifer and dear Dynare forum,

Thank you for your generous and detailed help.
I have an additional question regarding NK models with capital, so I add it to this thread (I hope that’s the right place).

I am looking at an (expansionary) monetary policy shock and noticed that the policy and the risk free rate go up.
At first, I thought, this must be a coding mistake, but now I think it is probably correct.
If I put large adjustment costs on capital, it becomes more intuitive: the nominal and real rate decrease, as I would have expected.

I also tried it in the Basu and Bundick (2017) model (I modified it so that the shock is expansionary and removed the utilization to come closer to my original model), and I find the same:
When I set the adjustment costs parameter, phi_k = 0.0 (or small), the real and nominal rate increases in response to an expansionary monetary policy shock (I attach the code).

My question is:
did anyone else experience this?
As the IRF looks quite odd, what would be typical solutions?

Thank you very much for your help and many greetings,
Basu_Bundick_2017_editM.mod (13.0 KB)
Basu_Bundick_2017_editM_steadystate.m (4.1 KB)