Open economy and steady problems

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

Error in ==> dynare_solve at 112
bad_cond_flag, varargin{:});

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

Error in ==> steady at 52

Error in ==> galicap7 at 200

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

can someone give any tips?

the mod file is attached.

galicap7.mod (3.95 KB)

Due to the parameter rho in equations 1 and 3 your model is not loglinear. Hence, computing the steady state fails.

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

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

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

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…
ch7Gali.pdf (358 KB)

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:

initval; rn=rho; i=rho; end;

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?

Usually, the answer is yes. IRFs can of course be permanent (but nevertheless correct), if a unit root is present.