Page 1 of 1

Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Thu Mar 16, 2017 11:45 am
by lombard
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: Select all
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;


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

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Thu Mar 16, 2017 12:12 pm
by jpfeifer
Hi Gianni,
there seem to be a couple of files missing, e.g. find_incell and str2cell.

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 8:09 am
by lombard
Sorry, you are right. Here they are.
Best,
Gianni

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 9:19 am
by jpfeifer
Can you please try the unstable version with "brute force", i.e. delete the
Code: Select all
bytecode

and go for
Code: Select all
simul(periods=100,stack_solve_algo = 0,robust_lin_solve) ;

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 1:17 pm
by lombard
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

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 4:12 pm
by lombard
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

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 4:32 pm
by jpfeifer
Hi,
I am missing the cell2str-function. But when I use
Code: Select all
simul(periods=10,stack_solve_algo = 0,robust_lin_solve) ;
options_.rplottype=1;
options_.nodisplay=0;
rplot Ye Yc RER;

the timing looks correct.

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 4:40 pm
by lombard
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.

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Fri Mar 17, 2017 4:50 pm
by jpfeifer
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.

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Tue Mar 21, 2017 9:40 am
by lombard
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

Re: Deterministic simulation: NAN residuals (zero pivot)

PostPosted: Tue Mar 21, 2017 7:52 pm
by jpfeifer
What you describe is strange. The most recent unstable version of Dynare should transform all problems to 1-lag problems.