Deterministic simulation: NAN residuals (zero pivot)

Hi,
I’m trying to simulate the transition from one steady state to another.
I’ve followed the very helpful slides of Sebastien (attached).
Unfortuntely for steady-state changes that are large enough there is no solution (NAN in the residuals) and all the solution algorithms return an error.
The threshold for the change in steady state for which a solution exist is super small (changes in the order of 10^(-7).

I’ve checked that the first order solution at both steady states has no unit root. So they are both locally stable.

This is the syntax I’ve used

[code]tr_obj_old=0;
tr_obj_new=0.00001;
global tr_obj
tr_obj=tr_obj_old;

initval;
e_trc =log(1+tr_obj);

end;

steady;

tr_obj=tr_obj_new;
endval;

e_trc =log(1+tr_obj);

end;

verbatim; %Note that ysINIT is a vector that contains the initial steady state values
tr_obj=tr_obj_old;
ys0_ = GB_subsidy_TR_steadystate;

tr_obj=tr_obj_new;
oo_.steady_state = GB_subsidy_TR_steadystate;
end;[/code]

where tr_obj is a global variable that changes the steady state computed in the file GB_subsidy_TR_steadystate.m .

I’ve checked the .m produced out of the .mod file and it seems that the initial (y0_) and final (oo_.steady_state) are correctly associated.

The NaNs appear in the Jacobia and residual at the second iteration.

Note that my model contains a number of variables that are constant in this exercise.

Any suggestion?

I attache a zipped folder with the model if you want to reproduce the error (not it is set to run stoch_simul. Just comment this and uncomment simul.
Thanks and best
Gianni

Gianni
ForDynHelp.zip (42 KB)
deterministic.pdf (323 KB)

Hi Gianni,
there seem to be a couple of files missing, e.g. find_incell and str2cell.

Sorry, you are right. Here they are.
Best,
Gianni
find_incell.m (798 Bytes)
str2cell.m (260 Bytes)

Can you please try the unstable version with “brute force”, i.e. delete the bytecode
and go for

simul(periods=100,stack_solve_algo = 0,robust_lin_solve) ;

You made my day!! And it’s Friday 8) 8)

It works like a charm.
Thanks Johannes!! (and the Dynare team, for the new solution algorithm!!)

Best
Gianni

Hi,
since I’m using the unstable version (master-2017-03-16-1022e67), you might want to know that the simulation output has an incorrect timing. The shock, while hitting at period 1, shows up in the output at period 5, and all the simulation is shifted by 5 periods for all variables.
Best
Gianni

Hi,
I am missing the cell2str-function. But when I use

simul(periods=10,stack_solve_algo = 0,robust_lin_solve) ; options_.rplottype=1; options_.nodisplay=0; rplot Ye Yc RER;
the timing looks correct.

sure. This is rplot. What I referred to was the output of the simulation
e.g.
jj=1;pos=varlist_indices(‘TRc’,M_.endo_names);
oo_.endo_simul(pos,1:10)
ans =
0 0 0 0 0.0100 0.0084 0.0071 0.0059 0.0050 0.0042
G.

Could you please provide me with the most recent version of the mod-file you run, including the log-file for your run? I am getting different results.

Hi,
sorry, just seen your message (must update the e-mail link)

I will send you the stuff. Just bad time now. Note that the initial zeroes might be due to the fact that I have four lags in innovations (news stuff).
It should be easy to trim oo_.endo_simul and the association to variables names accordingly for the Dynare team (unless you don’t prefer to keep it as it is, of course).
Cheers
gianni

What you describe is strange. The most recent unstable version of Dynare should transform all problems to 1-lag problems.