# Using simul, problem in law of motion in foreign debt?

Hi All,

I am solving a deterministic Ramsey (not DSGE) small open economy model. The setup is very similar to "“Closing Small Open Economy” by Schmitt-Groh & Uribe and I use debt dependent interest to pin down the steady state. the only difference is that in my model shock is unexpected ex-anti so I should use simul. I can solve the steady state without any problem and I set debt to be zero in the final steady state. My mod code can give me the transition path under shock path of TFP. However, the debt level has a jump during the last period and that law of motion in foreign debt does not hold in the last period.
In the model section I put
b=(1+rworld+rfun(b(-1),bbar, ppsi ))*b(-1)-nx;

since debt is predetermined this line shows that b is backward looking. However, in the last period the debt level should goes to the final steady state. My understanding of the routine simul is that it does not check that b=(1+rworld+rfun(b(-1),bbar, ppsi ))*b(-1)-nx hold in the last period. I believe that is why debt path is discountinous in the last period.

if I use b(+1)=(1+rworld+rfun(b,bbar, ppsi ))*b-nx(+1) then the initial debt is not used as an initial condition.

Basically in my mode initial debt and terminal debt are both determined. So my question is in simul, is there a way to write the law of motion of debt to make sure that both the initial debt and terminal debt are satisfied at the same time?

I have searched the forum and only find a few posts with similar issues that debt jumps in the last period but no answers.

Any help would be appreciated.

Anybody could help? Thanks in advance.

First of all, if your shock is unexpected, you cannot use the simul-command, because this is a perfect foresight simulation. Everything is perfectly known.

Secondly, you need to check whether that terminal value for debt matters or whether it is simply stored in the endogenous variables, because you set it in endval without it mattering at all. The point of the endval block for that last period is to set the terminal values for all variables that enter with a (+1) or more in the model block. Take the Euler equation. There you will have a c(+1) that is required. This c(+1) in the last period T, i.e. T+1 cannot be endogenously determined. That is why you need to provide it. If debt is purely backward looking, then debt in T+1 will depend on choices in time T+1, which you do not model. Put differently, what enters the Euler equation is c(T+1), which itself is a function of d(T+1). But given c(T+1) provided in the endval-block, you can set d(T+1) to anything, it will not matter, because only c(+1) shows up in your equations, not d(+1). Again put differently, it seems you choice for the other variables in the endval block are inconsistent with debt choice you claim to be present in the last period.

Johannes,

First when I wrote “shock is unexpected” I meant to emphasis that TFP does not follow an AR(1) process so that I could not use Stoch_simul as in Schmitt-Groh & Uribe. My shock process is a shock that is know at time 1.

Regarding your second point, I did assign endval block to be the finial steady state so c(T+1) and d(T+1) are consistent, so that is not the problem.

I want terminal value for debt to matter in our theoretical model and I want it to matter in my code. But if I use simul() I don’t know how to make it matter. The problem is how to use the law of motion of debt equation. In theory I only have one equation
b_t=(1+rworld+rfun(b_t-1,bbar, ppsi ))*b_(t-1)-nx_t, which holds from time b(1) to b_T+1.

If I write b=(1+rworld+rfun(b(-1),bbar, ppsi ))*b(-1)-nx; then this equation holds from time b(1) to b_T, the terminal value of debt is not used as a terminal condition.
if I write b(+1)=(1+rworld+rfun(b,bbar, ppsi ))*b-nx(+1); then this equation holds from time b(2) to b_T+1, the initial debt is not used as an initial condition

From your answer, it seems that to make both b(1) and b_T+1 matter I need debt to be both forward-looking and backward looking. But I don’t know how that could be implemented since I only have one equation.

Thanks a lot.

That is not what I am saying. Debt is forward looking via the the choice of net exports in your equation (which in turn depends on c(T+1) via the Euler equation and other (T+1) variables in your model). If you are sure the final state is correct so that c(T+1) and d(T+1) are actually consistent and d still jumps from T to T+1, then you must be far away from that steady state in time T, because by construction, in T+1 you jump to steady state.