Page 1 of 1

open economy and steady problems

PostPosted: Fri Feb 11, 2011 5:31 pm
by marcel
Hello everyone,

Im trying to replicate the gali's book open economy model and i'm having trouble with simulating it.

the problem must be with the exchange rate equation because when i get it off it works well.
The error that is show is:

??? Error using ==> mrdivide
Matrix dimensions must agree.

Error in ==> lnsrch1 at 64
alamin = tolx/test ;

Error in ==> solve1 at 127
[x,f,fvec,check]=lnsrch1(xold,fold,g,p,stpmax,func,j1,j2,varargin{:});

Error in ==> dynare_solve at 112
[x,info]=solve1(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag,
bad_cond_flag, varargin{:});

Error in ==> steady_ at 124
[oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...

Error in ==> steady at 52
steady_;

Error in ==> galicap7 at 200
steady;

Error in ==> dynare at 132
evalin('base',fname) ;


can someone give any tips?

the mod file is attached.

Thanks

Re: open economy and steady problems

PostPosted: Fri Feb 11, 2011 6:16 pm
by jpfeifer
Due to the parameter rho in equations 1 and 3 your model is not loglinear. Hence, computing the steady state fails.

Re: open economy and steady problems

PostPosted: Fri Feb 11, 2011 6:57 pm
by marcel
Thanks a lot for your answer.

could you explain me why is it a problem?
the stationary condition is satisfied with this calibration, and also I used this form for the parameter rho for closed economy and it works well... (the book uses the approximation rho=-log(beta) but is shows the same error anyway).

Re: open economy and steady problems

PostPosted: Fri Feb 11, 2011 7:28 pm
by jpfeifer
I would guess your linearization is wrong. If you linearized your model about the steady state, everything is now in (log) deviations from steady state. Hence, all endogenous variables have steady state 0. Using 0 as the steady state solves all your equations except for 1 and 3. When you look at these equations and set all variables to 0, what remains is an equation that says
Code: Select all
0 = rho

In general, if you linearize a model, all constant terms should drop out. Hence, there should be no rho.

Re: open economy and steady problems

PostPosted: Fri Feb 11, 2011 8:23 pm
by marcel
The log linearization is looks fine because rho~=-ln(beta) and beta is multiplying on FOC.
rho represents the natural interest rate when no shocks, so it shouldn't be zero..
The equation 1 and 3 in my mod file are the equations (40) and (39), could you please take a look?

Also when I set rho = 0, i get NaN in the moments of the exchange rate, maybe it can be related...

Re: open economy and steady problems

PostPosted: Sat Feb 12, 2011 7:33 am
by jpfeifer
Ok, I get it. The problem is that Gali has all variables in deviations from their steady state, except for rn and i, whose steady state is rho (which is a strange way that confuses Dynare). To solve your problem, initialize rn and i before the steady command by putting:
Code: Select all
initval;
rn=rho;
i=rho;
end;

Re: open economy and steady problems

PostPosted: Tue Feb 15, 2011 8:56 pm
by marcel
Thanks a lot! now it is working fine.

Just a question that i dont know how to proceed when i have a unit root in one of my equations (nominal exchange rate equation)?
When i get NaN in moments, does the dynamic of my model works properly?

Re: open economy and steady problems

PostPosted: Wed Feb 16, 2011 5:22 pm
by jpfeifer
Usually, the answer is yes. IRFs can of course be permanent (but nevertheless correct), if a unit root is present.