I am trying to extend BKK (1992) but for a setting with incomplete markets. I am following Baxter and Crucini (1995) but without adjustment costs on Investment (I am attaching the code)

I am using a log linearization arond the steady state. When I run the model, I get this error:

Error using print_info (line 37)
The generalized Schur (QZ) decomposition failed. For more information, see the documentation for
Lapack function dgges: info=11, n=9. You can also run model_diagnostics to get more information on
what may cause this problem.

My question was whether that replication coincides with what is reported in the paper. For example, should the countries be symmetric? Currently you have in steady state

You are right. In the paper they are assuming symmetric countries.

Now I got something but I think there is a problem with initial values. I mean, the solution is highly sensitive to them. Is there a way to avoid this?

You have 2 budget constraints, one for the Home country( H) (eq 1) and one for the foreign country (F) (eq 2). Additionally, you have a condition for bond market clearging: b_h + b_f = 0 (eq 3).

From this you can see that one of the condition is redundant. Or, in other words, you can use equation (3) to show that: b_h + b_f = 0 implies that: c_h + c_f + x_h + x_f = y_h + y_f.

Then you will end up with 2 budge constraints: one for country F (you could have choosen country H) and one aggregate budget constraint for the world economy.

From FOC on bonds, you have a condition that states that: price of the bond = beta*lambda(+1)/lambda(t) where lambda is specific to each country. In equilibrium, the price of the bond must be the same in home and foreign country. Then you can equalize these 2 conditions and get rid of the lagrange multipliers.

I implemented the changes that you put into your model. So, I removed the home budget constraint, I removed the bond market clearing, and replaced it with the goods market clearing (like what you did).

I also analytically calculate the steady state and in the long run, the IRF don’t return to 0.

var c cstar n nstar k kstar z zstar r rstar w wstar y ystar bstar q;
predetermined_variables k kstar bstar;
varexo e estar;
parameters beta theta delta rho rhostar sigma a;
beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1;
rho = 0.906;
rhostar = 0.05;
sigma = .00852;
model;
/*
Home Economy
*/
y = exp(z) * k^theta * n^(1 - theta);
/*
Constraints for home Economy
*/
/*
FOC - intra temporal, capital accumulation, and bond accumulation
*/
a/(1-n) = (1/c) * w;
(1/c) = beta * ((1/c(+1)) * (r(+1) + 1 - delta));
beta * (1/c(+1)) = q * (1/c);
z = rho * z(-1) + rhostar * zstar(-1) + e;
r = theta * exp(z) * k^(theta - 1) * n^(1-theta);
w = (1 - theta) * exp(z) * k^(theta) * n^(-theta);
/*
Foreign Economy
*/
ystar = exp(zstar) * kstar^theta * nstar^(1 - theta);
/*
Constraints for foreign Economy
*/
cstar + kstar(+1) + q * bstar(+1) = wstar * nstar + rstar * kstar + (1 - delta) * kstar + bstar;
/*
FOC - intra temporal, capital accumulation, and bond accumulation
*/
a/(1-nstar) = (1/cstar) * wstar;
(1/cstar) = beta * ((1/cstar(+1)) * (rstar(+1) + 1 - delta));
beta * (1/cstar(+1)) = q * (1/cstar);
zstar = rho * zstar(-1) + rhostar * z(-1) + estar;
rstar = theta * exp(zstar) * kstar^(theta - 1) * nstar^(1-theta);
wstar = (1 - theta) * exp(zstar) * kstar^(theta) * nstar^(-theta);
/*
Bond market clearing
*/
y + ystar = c + cstar + k(+1) - (1-delta)*k + kstar(+1) - (1-delta)*kstar;
end;
steady_state_model;
r = (1/beta) + delta - 1;
n = 1 / (1 + (a/(1-theta)) * (1 - delta * theta * (beta/(1 + beta * delta - beta))));
k = (r / (theta * n^(1 - theta)))^(1/(theta-1));
y = k^theta * n^(1 - theta);
w = (1 - theta) * (y / n);
c = y - delta * k;
q = beta;
//b = 0;
rstar = (1/beta) + delta - 1;
nstar = 1 / (1 + (a/(1-theta)) * (1 - delta * theta * (beta/(1 + beta * delta - beta))));
kstar = (rstar / (theta * nstar^(1 - theta)))^(1/(theta-1));
ystar = kstar^theta * nstar^(1 - theta);
wstar = (1 - theta) * (ystar / nstar);
cstar = ystar - delta * kstar;
bstar = 0;
z = 0;
zstar = 0;
end;
model_diagnostics;
resid;
steady;
shocks;
var e = sigma^2;
var estar = sigma^2;
corr e, estar = 0.258;
end;
stoch_simul(hp_filter = 1600, order = 1, irf=200);

From what I have been reading, the problem may be that there is a unit root in the model.

I think “Closing international real business cycle models with restricted financial markets” (Boileau and Normandin) may have an answer to this but it is not clear to me how to implement it.

That was very helpful. With this modificationthe unit root problem dissapears. Thank you a lot for sharing.

I am attaching a code where I replace log utility function by the function used in BKK. I defined some variables quiet different (a) I don’t have wages or rental rate for capital, b) I introduce an quation for investment, c) i work with leisure instead of labor) but just for my convenience, only minor changes to your code.

I will try to extend now this model to the case in which there are more agents per economy.

Look, this is the portfolio adjustment cost and I introduced two agents in each economy. The we end up with 4 agents (home-1, home-2, foreign-1, foreign-2).

There seems to be a problem with Blanchard Kahn conditions that I don’t know where it is coming from.

I am posing the condition that, in the equilbrium: b1h + b2h + b1f + b2f = 0., but I am not sure if that is enough.