Closing Small Open Economy with Debt elastic interest rate

Hi there,

I want to replicate the paper by Schmitt-Grohé and Uribe 2003 “Closing Small open Economy models”. I was able to compute the Models 1 and 1a for the endogenous discount factor. Then I tried to compute the Model 2 for the debt elastic interest rate and thats where the struggling began… Actually, I have no clue anymore how to proceed. I would like to have a model in exp() rather than levels to capture the %-age deviations from steady state.

I would appreciate it if someone had a hint on where to start with the corrections.

Thanks for your comments,


I figured out (with the great help from my professor F.Collard) how to do it.

For the ones who are interested in solving SOE models some hints:

  1. If you have a model with %age deviations from Steady State, i.e. in exp(), then make sure that foreign assets (usually d_t, sometimes b_t) can be negative and hence logs cannot be taken. So this variable should not be written as exp(d) rather just d. This also holds for the trade balance and the current account!

  2. Make sure you get the right initial values. If you have exp(k)… in your equation, then the initial value should be k = log(kss) or something similar. This is the substitution you were making when substituting k by log(k) (from unit deviation to %age deviation).

  3. Make also sure that the lambda (marginal utility of wealth) is expressed in exp().

I hope I could help some of you, students mainly, who encountered some similar problems as I did when starting with dynare.

Sincerely, Philipp

Hi Philipp,

I also work with the SOE model which I expressed in exp() in Dyanre. As yourself, I also figured out that NFAs must be in levels. Therfore, I agree with all your points and remarks. However, I would like to double check with you if my thinking is correct on implementing an exponential function to ‘close’ the model. In particular, if the function is of the form:


  1. I need to assume that the ss of d (i.e., dbar)=0
  2. And then, do I want to take another exponent because the model is in exp(), ie., exp(psi*[exp(d-dbar)])
    or - simply have psi*[exp(d-dbar)-1]

What is your opinion?

Thanks a lot,

Dear Monika,

I’m truly sorry that I haven’t answered before, I hope you were able to figure out how to do it anyways.

Actually, there is a really elegant way how to deal with the problem:

First, in an open economy the level of debt can be negative so you cannot take logs, this is yet not true for the other variables. Thus it is possible to write the model in %-age deviations from Steady State.

Second, I told dynare to compute the risk premium:

risk = psi*(exp(d-d_bar)-1);

and then the interest rate follows:

exp® = r_w+risk;

This gives the euler equation of the form:

// FOC wrt d (Euler Equation)
exp(lambda) = beta*(1+exp®)*exp(lambda(+1));

I hope I could help you with that.

I’ll send you the complete model anyways.


soe_2.mod (3.92 KB)

Hi Phillip,

I am a student who is trying to replicate the SGU models as well. I was able to replicate the debt elastic interest rate and portfolio adjustment costs but not the endogenous discount factor ( 1, 1a) and the complete markets model. In your earlier post you said that you were able to figure out the two versions of the endogenous discount factor and I was wondering if you could post the file for me.

Thank you

Here is my file for the endogenous discount factor model. The first one is model 1 and the second is model 1A.

m1a.mod (2.31 KB)
m1.5.mod (2.81 KB)

Some of the above files contained errors. A (hopefully correct) replication file for Schmitt-Grohe/Uribe (2003): “Closing small open economy models”, Journal of International Economics, 61, pp. 163-185 is available on my homepage at

Dear community,

I have a question regarding Model 3: Portfolio Adjustment Costs in SGU 2004. They write “In this model, stationarity is induced by assuming that agents face convex costs of holding assets in quantities different from some long-run level.” I would like to know how to determine this long-run level? Would I use the steady state value for that?

I appreciate any hints!

Yes, that long-run level is the steady state. How you set it is up to you. Usually, it is based on some data moment.

Thank you for your help! One more question if you will:

At the moment I am just playing around with a toy model, hence the long-run level cannot be based on data. I calculated the steady state without portfolio adjustment costs and inserted the values as long-run levels into the model version with portfolio adjustment costs. Is that the correct approach?

Thank you for your time!

No, that cannot be correct. Without portfolio adjustment costs, there are infinitely many steady states as the reason to introduce those costs is to select a unique one. My guess is that you actually computed the steady state with 0 steady state debt. That is a good way to start.

Sorry for reviving this topic.

I would like to model a small open economy with financial intermediaries. In the model, households are expected to be forbidden to the international financial market. Only banks can participate in. How to add an adjustment cost in this sort of model, on the household side or on the bank side? Can I totally ignore this stationarity requirement?


To be specific:
Is the logic firstly writing a model without any correction term, when impulse response functions tell me explosive dynamics, then I add it?
OR is the logic, at the very beginning and in any circumstance, embedding a small term consistent with SGU (Closing SOE, 2003), no matter what IRFs look like later?

I find a two-country model, instead of an SOE, paper adding a term to induce stationary behaviors as well. On the other hand, in Gali and Monacelli (RES, 2005), the SOE model has completely no such a term. When I’m drafting a paper, how to decide whether or when I should include a portfolio adjustment cost term or debt elastic interest rate or endogenous discount factor?

  1. It’s all up to the model builder. Unit roots arising in this context are not a problem for IRFs, only for moments.
  2. It’s hard to give general advice as model details may matter. But a good way is to start without such an adjustment term and then see whether IRFs are stationary.
  3. At first order, it does not really matter which type of stationarity-inducing device you use. That is the pont of the SGU paper.
  4. Gali/Monacelli use complete markets, which is another way to proceed.
1 Like

Thank you so much!!

Hi Prof. J Pfeifer,

Dynare reports that:

There are 8 eigenvalue(s) larger than 1 in modulus for 10 forward-looking variable(s)

The rank condition ISN'T verified!


Blanchard & Kahn conditions are not satisfied: indeterminacy.

I use model_diagnostics,

>> model_diagnostics(M_, options_, oo_)
MODEL_DIAGNOSTICS:  No obvious problems with this mod-file were detected.

My model is a bit huge. So before attaching codes on the forum, I would like to know: Will missing the adjustment cost induce the rank condition and BK condition failure?

If the answer is yes, I will immediately include it. If no, I have to check other aspects.

No, usually the adjustment costs just kill a unit root, but would not alter the BK conditions.

I am just playing around with a toy model, hence the long-run level cannot be based on data..