Singular Jacobian in multicountry RBC

I work in the Dpt for Environment in the government of the UK and I have tried to build a model reflecting two countries, one at risk of experiencing some flooding and the other not at risk. The model works fine in autarchy but when I introduce the possibility of trade I get the following message even when I set imports to be zero at any time

??? Error using ==> lnsrch1 at 71
Some element of Newton direction isn’t finite. Jacobian maybe singular or there is a
problem with initial values

Sure this is something very trivial but I´m not able to figure out what it is.
Any help?
Thank you
autarchy.mod (4.67 KB)
trade.mod (5.05 KB)

Using model_diagnostics, I get:

[quote]MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 1 colinear relationships between the variables and the equations
Colinear variables:
Colinear equations
18 19

MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.[/quote]

This may be related: [The rank condition ISN'T verified_1 colinear relationship)

Thank you Johannes for your rapid response,
I´m new to dynare and I haven´t done any modelling since the late 80s so I´m quite “rusty” and probably overlooking trivial things (by the way, how do you use model_diagnostics? I mean, where do you place this command?) However
I´m confused since eq 18 and 19 are

@#for co in countries
((c_@{co}(+1)/c_@{co})^gama_@{co})/beta_@{co} = 1+r;

that define demand for imports in one country and exports in the other. I don´t see how I can go without any one of them. Besides, when I set m to be a fixed quantity (as a parameter) the model doesn´t work, even with m = 0 which should be the same case as autarchy

The model I´m trying to solve is model 2 and FOC are in annex 2

First of all, use the most recent unstable version of Dynare. I needed to use

to find a steady state.

After running your file with this command, you can just use

From what it sounds like, your problem is in closing the model. Could it be that imports in one country need to equal exports in the other country and the second equation just imposes that again?

A good way to start is to use both countries in full autarky and make sure the file runs (starting from the autarky file). Then you try to link those countries.

Hello again and thanks for your time and your understanding

I´ve tried, The model starts failing when I introduce any of the set of equations
beta_N*((c_N/c_N(+1))^gama_N) = 1+r;
even when considering r a fixed parameter) to avoid having to include the other country and market clearing. I got the following message

??? Error using ==> print_info at 74
Impossible to find the steady state. Either the model doesn’t have a steady state, there
are an infinity of steady states, or the guess values are too far from the solution

So I thought an initial and final condition on debt would solve the problem



but it didn´t

But 0 is not the steady state for debt. It will depend on m_N. Try providing the correct values.