# Two Open Economies Growth Model

Hi,

I’m trying to solve a perfect foresight model of two open economies. Each economy was originally closed and they have different capital stocks. I am interested in the growth path after integration.

I know there’s a rank condition in steady-state, therefore I want to impose that the final debt level is equal to constant. I know this violates the transversality condition, but my final goal is to write the code in a shooting setting.

With my current set up, dynare says that I either have a singularity problem or if I set the value of the interest rate and debt for the steady-state, it tells me that they are not parameters. How should I set up the final condition?

Find my code below: I have the simplest set up: no labor, log preferences, both countries have the same parameters.

``````//Two open Economies, perfect foresight model.

//***
//---1. Define variables
//***
var cA cB kA kB d r;

//***
//---2. Define predetermined variables
//***

predetermined_variables kA kB r d;

//***
//---2. Define parameters
//***

parameters B beta delta gamma sskA sskB sscA sscB ssd ssr;

//***
//---3.Set parameters
//***

set_param_value('B', B);
set_param_value('gamma',gamma);
set_param_value('beta',beta);
set_param_value('delta',delta);
set_param_value('sskA',sskA);
set_param_value('sskB',sskB);
set_param_value('sscA',sscA);
set_param_value('sscB',sscB);
set_param_value('ssd',ssd);
set_param_value('ssr',ssr);

//***
//--- 4. Equations
//***

model;
[name='kA']
(cA(+1))/cA = beta * (1 + B * gamma * kA(+1)^(gamma - 1) - delta );

[name='kB']
(cB(+1))/cB = beta * (1 + B * gamma * kB(+1)^(gamma - 1) - delta );

cA = B * kA^gamma - kA(+1) + (1 - delta) * kA - (1 + r) * d + d(+1);

cB = B * (kA^gamma + kB^gamma) - cA - (kA(+1) + kB(+1)) + (1 -delta) * (kA + kB) ;

[dynamic](cA(+1))/cA = beta * (r(+1) - delta );
[static] r = (1/beta) - 1;

[dynamic]d(+1) = B * kB^gamma - cB - kB(+1) + (1 - delta) * kB + (1 + r) * d ;
[static] d = ssd;

end;

//***
//---5. Initval-block: set initial condition of capital
//***

initval;

cA = sscA;

cB = sscB;

kA = 0.8*sskA;

kB = 0.8*sskB;

d = 0;

r = ssr;

end;

//***
//--- 6. Endval-block: set terminal condition to steady state value
//***

endval;

kA = sskA;

kB = sskB;
cA = sscA;

cB = sscB;

d = ssd;

r = ssr;

end;

perfect_foresight_setup(periods= 100);
perfect_foresight_solver;
``````

You forgot the `param.mat` to run the model.

I know the problem is coming from dynare not identifying the correct number of equations = N*T. I thought that by giving it the steady state system and the initial and the final debt levels I was obtaining the right number.

Here’s the version with the parameters:

``````//Two open Economies, perfect foresight model.

//***
//---1. Define variables
//***
var cA cB kA kB d r;

//***
//---2. Define predetermined variables
//***

predetermined_variables kA kB r d;

//***
//---2. Define parameters
//***

parameters B beta delta gamma sskA sskB sscA sscB ssd ssr;

//***
//---3.Set parameters
//***

B = 1.3053;
gamma = 0.3762;
beta = 0.9554;
delta = 0.0406;
sskA = 15.9594;
sscA = 3.0541;
sskB = 15.9594;
sscB = 3.0541;
ssd = 0;
ssr = 0.0467;

//***
//--- 4. Equations
//***

model;
[name='kA']
(cA(+1))/cA = beta * (1 + B * gamma * kA(+1)^(gamma - 1) - delta );

[name='kB']
(cB(+1))/cB = beta * (1 + B * gamma * kB(+1)^(gamma - 1) - delta );

cA = B * kA^gamma - kA(+1) + (1 - delta) * kA - (1 + r) * d + d(+1);

cB = B * (kA^gamma + kB^gamma) - cA - (kA(+1) + kB(+1)) + (1 -delta) * (kA + kB) ;

[dynamic] (cA(+1))/cA = beta * (r(+1) - delta );
[static] r = (1/beta) - 1;

[dynamic] d(+1) = B * kB^gamma - cB - kB(+1) + (1 - delta) * kB + (1 + r) * d ;
[static] d = ssd;

end;

//***
//---5. Initval-block: set initial condition of capital
//***

initval;

cA = sscA;

cB = sscB;

kA = 0.8*sskA;

kB = 0.8*sskB;

d = 0;

r = ssr;

end;

//***
//--- 6. Endval-block: set terminal condition to steady state value
//***

endval;

kA = sskA;

kB = sskB;
cA = sscA;

cB = sscB;

d = ssd;

r = ssr;

end;

perfect_foresight_setup(periods= 100);
perfect_foresight_solver;
``````

When trying to check the eigenvalues, I get:

``````The solution to the static equations is not a steady state of the dynamic model: verify that the equations tagged by
[static] and [dynamic] are consistent
``````

This is the current version:

``````
//Two open economies
//***
//---1. Define variables
//***

var c2A kA c2B kB d r;

//***
//---2. Define parameters
//***

parameters B gamma lambda beta delta ssc2A ssc2B sskA sskB k0 ssd ssr e0;

//***
//---3.Set parameters
//***

B = 1.3053;
gamma = 0.3762;
beta = 0.9554;
delta = 0.0406;
sskA = 15.9594;
sscA = 3.0541;
sskB = 15.9594;
sscB = 3.0541;
ssd = 0;
ssr = 0.0467;

//***
//--- 4. Equations
//***

model;

[name='Output Manufacturing A']
c2A = B * kA(-1)^gamma - lambda * kA + (1 - delta) * kA(-1) - (1+r(-1)) * d(-1) + d;

d = B * kB(-1)^gamma - lambda * kB + (1 - delta) * kB(-1) + (1+r(-1)) * d(-1) - c2B;

[name='Euler Equation kA']
(lambda * c2A(+1))/c2A = beta * (1 + B * gamma * kA^(gamma - 1) - delta );

[name='Euler Equation kB']
(lambda * c2B(+1))/c2B = beta * (1 + B * gamma * kB^(gamma - 1) - delta );

[name='Euler Equation d']
c2A(+1)/c2A = beta * ( 1 + r);

[name='Output Manufacturing B']
c2B = B * (kA(-1)^gamma + kB(-1)^gamma) - c2A - (kA + kB) + (1 -delta) * (kA(-1) + kB(-1)) ;

end;

kA = (((1/beta) + delta - 1)/(B * gamma))^(1/(gamma-1));
kB = (((1/beta) + delta - 1)/(B * gamma))^(1/(gamma-1));
r = (1/beta) - 1;
d = ssd;
c2A = B * kA^gamma - kA + (1 - delta) * kA - (1 + r) * d + d;
c2B = B * (kA^gamma + kB^gamma) - c2A - (kA + kB) + (1 -delta) * (kA + kB) ;
end;

//***
//---5. Initval-block: set initial condition of capital
//***

initval;

c2A = ssc2A;
kA = 0.8*sskA;
c2B = ssc2B;
kB = 0.8*sskB;
d = ssd;
r = B * gamma * (0.8*sskA;)^(gamma - 1) - delta;

end;

endval;
c2A = ssc2A;
kA = sskA;
c2B = ssc2B;
kB = sskA;
d = ssd;
r = ssr;
end;

resid;

simul(periods=100);
``````

You are using `ssc2A`, but you did not set it.