Page 1 of 1

singular Jacobian in multicountry RBC

PostPosted: Sun Jun 01, 2014 10:48 am
by antopon
Hello,
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

Re: singular Jacobian in multicountry RBC

PostPosted: Sun Jun 01, 2014 11:03 am
by jpfeifer
Using model_diagnostics, I get:
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:
y_R
c_R
k_R
l_R
Debt_R
y_N
c_N
k_N
l_N
Debt_N
d
f
g
m
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.

This may be related: http://www.dynare.org/phpBB3/viewtopic.php?f=2&t=5683

Re: singular Jacobian in multicountry RBC

PostPosted: Sun Jun 01, 2014 1:05 pm
by antopon
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;
@#endfor

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

Re: singular Jacobian in multicountry RBC

PostPosted: Sun Jun 01, 2014 1:37 pm
by jpfeifer
First of all, use the most recent unstable version of Dynare. I needed to use
Code: Select all
steady(solve_algo=4,maxit=1000);

to find a steady state.

After running your file with this command, you can just use
Code: Select all
model_diagnostics(M_,options_,oo_)

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.

Re: singular Jacobian in multicountry RBC

PostPosted: Sun Jun 01, 2014 5:12 pm
by antopon
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;
Debt_N(+1)=Debt_N*(1+r)+m_N;
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

initval;
Debt_N=0;
end;

endval;
Debt_N=0;
end;

but it didn´t

Re: singular Jacobian in multicountry RBC

PostPosted: Mon Jun 02, 2014 5:13 am
by jpfeifer
But 0 is not the steady state for debt. It will depend on m_N. Try providing the correct values.