I am trying to run a simplified version of the model by Chen et al. (2012). In basic terms, there are two types of agents. The first type called “u” can buy both short and long-term bonds, but they have to pay a transaction cost to buy the long-term bonds. The second type called “r” can only buy long-term bonds, but don’t have to pay transaction costs. Basically, this modification makes the long-term interest rate matter separately from the short-term.

I am getting a unit root, which is also generating a collinearity between my two consumption variables for the two types of agents. (or is it the other way around?). I am posting the code. I am getting a collinearity between my three euler equations (for short-term bonds, long-term if type “r” and long-term if type “u”) and my gov. budget constraint plus the tax and long-term bond rules and the transaction cost equation. I am not quite sure if there is a misspecification in the model. I would appreciate it if someone can check the code and see if there is something obvious that I have missed.

I talked to some friends who worked on that model and they report that this is a problem/mistake in the original paper, i.e. not a mistake you did. There is a unit root together with a fundamental singularity in the model reported in the paper. It has been suggested you should try to contact Andrea Ferrero about the issue if you want to keep working on this model. I have not verified this issue. You also might want to check out the other posts related to this model:

Thank you Johannes. I would have likely wasted a lot of time trying to figure out what is causing the issue. I e-mailed Andrea Ferrero. I will post his reply to this thread, so that everyone can benefit from it.

I am still not sure what the issue is, but I am beginning to wonder whether it may have something to do with the Blanchard-Kahn method of solving DSGE models. Han Chen sent me a link to all of their codes for this paper. The model is solved in Matlab through Sims’ Expectational Errors method and his gensys algorithm, which he wrote in order to put his method in practice. This method is more general than Blanchard-Kahn and now I am wondering if there is something in the Blanchard-Kahn framework which dynare uses compared to Sims’ method.

You should not confuse the Blanchard-Kahn algorithm for solving models with the Blanchard-Kahn conditions. The latter describe the conditions for a unique bounded solution.
The Blanchard-Kahn solution algorithm is indeed less general than gensys, because you cannot have static variables. Dynare does not use Blanchard-Kahn to obtain the solution. But once you have the solution and the eigenvalues, the same conditions on uniqueness and existence apply.

That being said: when you have their code, you should be able to trace any difference. Is their entered model (before solving) the same as yours and do you get the same steady state?

I did not want to mix up the BK conditions with the BK algorithm. It is not as easy to compare at the moment, since my model is not 1 to 1 with theirs, plus their code has a whole bunch of functions and it will take a while for me to disentangle things.

Update: I thought the issue might be that Dynare can’t handle singular G_0 matrices, but then I read that it uses Klein’s method, which handles singular matrices. Then I wonder if Klein’s and Sims’ method differ in other ways that might make this model solvable in gensys as opposed to Dynare. I am reading more on that.

The model still has one degree of freedom left. No algorithm will give you a unique solution in this case, because there is nothing that would pin down the remaining expectational error. That is the reason why I am asking whether their model in their code features the same problem - and if not, where it differs from your implementation.

Ok, so I solved Chen et al. (2012)'s model on my own with gensys. To make sure that my output is correct, I solved the simple 2 period NK model in dynare and then in Gensys to make sure that I get equivalent results. Their model does output a unique equilibrium. My model which gives me the unit root in dynare does not yield unique equilibria. Hence, their is something wrong in my setup, which I have to identify.

I find it puzzling, because this model is a reduced form of theirs. What I differ in their specification is that I exclude sticky wages, capital utilization and I used Rotemberg AC instead of Calvo pricing. Something about the segmentation must be interfering with my specification.

In any case though, there doesn’t appear to be a fundamental problem with their model.

@sp1589 That is not entirely clear, unless you verified that their coded equilibrium conditions really coincide with the actual equilibrium conditions. It may be that in the additional features added, there is something weird happening and your approach is actually correct. That is the tricky part if results do not match in a replication study. You do not really know who made the mistake. A priori, it is more likely you were the one doing something wrong, but given that many people seem to have tried to replicate the paper and failed, I would say the probability is closer to 50:50. Thus, I would not blindly trust their code being correct.

Okay, I actually solved Chen et al.(2012)'s model in Dynare. Since, I have their code i copied their equations in dynare and made the necessary modifications. Their model does exhibit a unit root. In fact there are two of them.

Now my issue is this. Is this model supposed to generate a unit root or the unit roots in the model are present due to a misspecified model. I am not sure how I can figure that out unless any of the coauthors respond to my e-mails. I will e-mail them again. I will also appreciate any suggestions. I would really prefer not to give up on using this model if I can.

Are there only unit roots or is there also the singularity issue? And which variables does not the unit affect? You should be able to see this as the theoretical moments of the variables will be NaN.

There are both unit roots and the singularity issue. By that I suppose you refer to whether the Jacobian matrix of the static model is singular. Yes, it is and it leads to a collinearity issue. Non of the theoretical moments of the variables are NaN. I have attached the dynare files for both their model and mine. The only difference is that my model has only one unit root, while theirs has two. For both models, the Jacobian is singular. Is that what you mean by singularity?

Can you please take a look and let me know what you think Johannes?

Vasco Curdia said that there is a unit root, because of the way they defined fiscal policy. I am working on alternative forms to try to get rid of the unit root, but i am still not one hundred percent certain that is the issue.

A unrelated question. How can I get the original input matrices of my model in dynare? That is in a model of the form:

Ax_t=Bx_(t-1)+Cz_t I would like to recover the matrices A and B. That is, I want to recover the original input matrices of the state space form and not the solution: x_t=Gx_t-1+Dz_t.

But then the question is how they solved that unit root issue in their Dynare replication codes.
What do you mean with “original input matrices”? Because what you wrote down is the solution as it is purely backward-looking.

Sorry, my timing was supposed to be at t+1 and t. I simply meant the matrices that describe the equilibrium system before a solution method is applied.

I found an issue in how I was defining the market value of long-term debt. That was causing my unit root under a standard environment where the short-term nominal rate adjusts. The unit root is still present when I try to incorporate the ZLB for T periods. Perhaps that is what Vasco Curdia was referring to since they have a 4 period peg in their model. I am using the same definition of their peg in a simple setup, but the unit root does not go away. I am working on figuring that out.

Okay got it. Thank you. It is surprising that this part hasn’t been automated yet, because looking at those matrices might help with identifying problems in a model.

As a separate question, can you refer me to an existing relatively comprehensive deterministic model in Dynare? I haven’t solved one of those in Dynare before and I am not very familiar with the code/notation. Also, how would one incorporate an interest rate peg in a deterministic setup?