Generalized Schur (QZ) failed - Baxter and Crucini's model

Hello eveyone,

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.

Do you know what can be causing this problem?

Thank you,
Emili0

Bond.mod (2.8 KB)

Does the replication without any change work?

Thanks for answering Johannes.

This is my replication( ). Now it seems that I am having a potential “unit root problem”.

Emilio

Bond.mod (2.9 KB)

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

kh 		 23.3145
kf 		 0.0247

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?

Thank you again,
EmilioBond.mod (3.2 KB)

Hi Emilio,

I am doing a model based on the same paper (Baxter and Crucini) and I have a few questions about your code;

  1. Why is there only one resource constraint? Why didn’t you specify resource constraint for the home country?

  2. Why do you equalize the Lagrange multiplier?

Hello,

This is why:

  1. 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.

  1. 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.

Emilio

No the model is (almost) symmetric. Do results now coincide with the original paper?

Hi Emilio,

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.

I have another model that is closed with portfolio adjustment cost. I will share once I completed it.

Read Schmidt Grohe about closing small open economy. Their solutions are debt elastic rate, portfolio adjustment cost, endogenous discount rate.

Here is a model with portfolio adjustment cost. If you run it, all of the variable return to SS after 150 periods.

var c cstar n nstar k kstar z zstar r rstar w wstar y ystar b bstar q;
predetermined_variables k kstar b bstar;
varexo e estar;
parameters beta theta delta rho rhostar sigma a bbar pac;

beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1;
rho = 0.906;
rhostar = 0.05;
sigma   = .00852;
bbar = 0;
pac = 0.00074;

model;
/*
Home Economy
*/
y = exp(z) * k^theta * n^(1 - theta);

/*
Constraints for home Economy
*/
c + k(+1) + q * b(+1) + 0.5 * pac * (b(+1) - bbar)^2 = w * n + r * k + (1 - delta) * k + b;

/*
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 + pac * (b(+1) - bbar)) * (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) + 0.5 * pac * (bstar(+1) - bbar)^2 = 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 + pac * (bstar(+1) - bbar)) * (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
*/
b(+1) + bstar(+1) = 0;
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;

b = 0;
q = beta - pac * (b - bbar);


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(order = 1, irf=200);

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.

Emilioportfolio_2.mod (2.3 KB)

No problem.

I am doing the same model, but I have a debt limit constraint, which made the problem more complicated to implement in Dynare.

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.

Maybe Professor @jpfeifer can give us his view.

Thank you
portfolio_2_2agents.mod (3.7 KB)

I think I found the error. I did not declare predetermined variables correctly.

It should be fine now:incomplete_markets.mod (4.0 KB)

Best,
Emilio