Sorry.

I’m trying to implement this algorithm in a Smets&Wouters (2007) model. It’s in levels. I want to look at the ZLB.

It seems this code is designed for a model in logs, and I did notice the footnote in the paper explaining that I’d need to convert to ratios instead of differences and then multiply by the exponetial of the shadow price shock, but I am having a small problem locating in the code the place to switch to ratios, and I was also wondering what you do for second order pertubations.

Also, do I mostly leave everything alone in the code? Do I simply put my own vars/varexos/parameters in, my model in the model block with the exponential of shadow_price multiplied to my interest rate rule, leaving all the parts defining shadow_price alone?

Any help you can offer would be of immense help. It is a road block in my research, but it isn’t completely time urgent either, so I understand if you’re busy at the moment. Also, if I work it out I promise to post on here so you don’t do any work I won’t need.

Brett

You can also just write the Taylor rule equation in logs. So log( R ) = phi_pi * log( PI ) + … + shadow_price

Perhaps that’s easier?

That’s great!

A second problem comes from the fact that I have a nonlinear model and I want to make dynare take a second order approximation of it. Instead of specifying “model( linear );”, would I simply use “model;” and then “log( R ) = phi_pi * log( PI ) + … + shadow_price^2” as my rule?

At second order, you have to use a different algorithm to impose the ZLB. Following some referee comments, we’re currently working on improving this algorithm, so perhaps you should wait until the next draft of our paper if you want to do second order stuff.

Thanks! I would be glad to read it. What is the condition for including shadow_price^2?

It seems like the code in the zip file contains a small bug. The lower bound on the simulated interest rate appears to amount to -log(1/beta), minus the steady state value of the interest rate.

Is it correct if I changeline 85 in SIMU_CONS.m as follows?

```
%SIMU_CONS( order_var, i ) = dr.ghx*yhat + dr.ghu*transpose( ex_temp );
SIMU_CONS( order_var, i ) = Var_cons_steady + dr.ghx*yhat + dr.ghu*transpose( ex_temp );
```

Best, Daniel

Hi, I am working with a standard CGG model, trying to introduce a zero lower bound (i>=0) in a model with inflation targeting rule (inflation = 0). I want to do a deterministic simulation (simul). I don’t understand how do you introduce this when you have inflation targeting rule. Any help would be appreciated. Thanks,

code^sigma = beta/((C(+1))^sigma)*(1+i)/pibar(+1);
K = (theta/(theta-1)) * (L^(nu)) Y/Z + alpha * beta * (pibar(+1)^theta)K(+1);
F = C^(-sigma) * Y + alphabeta(pibar(+1)^(theta-1))*(F(+1)) ;

K = F*(((1-alpha

*pibar^(theta-1))/(1-alpha))^(1/(1-theta))) ;*

1/pstar = ((1-alpha)(((1-alpha*(pibar)^(theta-1))/(1-alpha))^(theta/(theta-1))) + alpha*(pibar^theta)/pstar(-1));

1/pstar = ((1-alpha)

Y/pstar = Z

*L;*

pibar = 1;

Y = C; //resource constraint

Z - 1 = 0.9(Z(-1) - 1) + eps_Z; [/code]

pibar = 1;

Y = C; //resource constraint

Z - 1 = 0.9

HI. I try to replicate the code of paper “Market and Non-Market Monetary Policy Tools in a Calibrated DSGE Model for Mainland China”

But when I run the program, I am told that "Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

Could you please give me some advice on this problem or sharing your code of this paper?

Thanks a lot.

[quote=“Michael Paetz”]Finally, Tom and I have a working paper on the algortihm, used for simulations:

uni-hamburg.de/fachbereiche- … uality.pdf

We simulated a two-country NKM and the Smets & Wouters(2003) Model using the shadow price method.

I also attached the Code for a sinlge country NKM for IRFs and Simulations, so that everyone can use it. Although the files should be selfexplaining, do not hesitate to contact me, if you experience any problems.

If someone is interested, here are two Papers, using the method for applications apart from monetary policy:

suomenpankki.fi/bofit_en/tut … dp1112.pdf

suomenpankki.fi/bofit_en/tut … dp1612.pdf

Best

Michael[/quote]

interestrate.mod (7.16 KB)

(d_ss, e_ss, l_ss) are not set.

Thank you for your advice. After setting these stuff, the model stil fails.

Have you ever read Michael Funke and Michael Paetz`s paper, “Financial system reforms and China’s monetary policy framework: A DSGE-based assessment of initiatives and proposals”. In model with zero lower bound, how could they introduce the market rate while there exist another rate call regulated rate at the same time. I do not how this could be possible in the dynare program.

interestrate.mod (7.16 KB)

The file you posted is not updated. The parameters are still unset. What is the new error message? No I haven’t read the paper.

Thank you again for your suggestion. After modifying the code, it seems that the syntax is correct now. But the problem is when I run the mod file, it still shows “Starting MATLAB/Octave computing” after two hours. I am really confused.

Wish you could give me some suggestions.

Many thanks.

Configuring Dynare …

[mex] Generalized QZ.

[mex] Sylvester equation solution.

[mex] Kronecker products.

[mex] Sparse kronecker products.

[mex] Local state space iteration (second order).

[mex] Bytecode evaluation.

[mex] k-order perturbation solver.

[mex] k-order solution simulation.

[mex] Quasi Monte-Carlo sequence (Sobol).

[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.1).

Starting preprocessing of the model file …

Found 491 equation(s).

Evaluating expressions…done

Computing static model derivatives:

- order 1

Computing dynamic model derivatives: - order 1

Processing outputs …done

Preprocessing completed.

Starting MATLAB/Octave computing.

NKM_ZLB4.mod (7.39 KB)

I was reminded about this thread earlier today. This is just an update to let you know that there’s a spiritual successor to this code available from:

The new code is both much easier to use and more accurate. The algorithm also has a more rigorous theoretical justification.

I’ve been trying to use DynareOBC to solve a simple NK model where I impose that r=max(taylor,0) . The only shock I consider for the moment is a TFP shock. Using dynareOBC on the uploaded code gives me the following error:

dynareOBC does not support cases in which the constraint just binds in steady-state

Strangely, when I simulate the model without constraint, the interest does become negative, so the constraint should be binding.

Do you guys have an explanation for this?

Thanks in advance

simple_NK.mod (2.27 KB)

You have:

`(1+i)/(1+i_ss) = max(something,1);`

You meant:

`(1+i)= max((1+i_ss)*something,1);`

I wonder anyone has a sample code for the global method with the ZLB? How should we interpret “max{0, i*}” as a spline or Chebyshev?

Thanks in advance!

@xuz: Global methods like projection methods are not yet implemented. There is the stochastic extended path, which is experimental in the unstable version.

Hi, Michael!

Can we use the same algorithm in a model with more than one shock? I see that there is only one shock in the model. Another question, do I need to linearize the model before I use this algorithm?

Niraj