Deterministic simulation: NAN residuals (zero pivot)

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Thu Mar 16, 2017 11:45 am

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
Attachments
ForDynHelp.zip
two-country model with permanent increase in tariffs
(42.03 KiB) Downloaded 44 times
deterministic.pdf
Sebastien's slides
(323.3 KiB) Downloaded 120 times
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby jpfeifer » Thu Mar 16, 2017 12:12 pm

Hi Gianni,
there seem to be a couple of files missing, e.g. find_incell and str2cell.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Fri Mar 17, 2017 8:09 am

Sorry, you are right. Here they are.
Best,
Gianni
Attachments
find_incell.m
(798 Bytes) Downloaded 41 times
str2cell.m
(260 Bytes) Downloaded 41 times
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby jpfeifer » Fri Mar 17, 2017 9:19 am

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) ;
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Fri Mar 17, 2017 1:17 pm

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
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Fri Mar 17, 2017 4:12 pm

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
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby jpfeifer » Fri Mar 17, 2017 4:32 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Fri Mar 17, 2017 4:40 pm

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.
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby jpfeifer » Fri Mar 17, 2017 4:50 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby lombard » Tue Mar 21, 2017 9:40 am

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
lombard
 
Posts: 132
Joined: Wed Feb 02, 2005 12:36 pm
Location: Basel

Re: Deterministic simulation: NAN residuals (zero pivot)

Postby jpfeifer » Tue Mar 21, 2017 7:52 pm

What you describe is strange. The most recent unstable version of Dynare should transform all problems to 1-lag problems.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests