Dynare calls external steady state file twice

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.

Dynare calls external steady state file twice

Postby twin » Wed Nov 25, 2015 7:34 pm

Hi,

I'm currently solving a model where I use an external _steadystate.m file, and I find that Dynare calls this function twice per run. This seems unnecessary, and actually costs me a fair bit of time because the steady state is complicated to compute. Is there a way to get it to only call the external function once? Why does Dynare call the external function twice?

Thanks!

Tom
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm

Re: Dynare calls external steady state file twice

Postby jpfeifer » Thu Nov 26, 2015 8:50 am

Please provide more context on what you are trying to achieve and which Dynare routines you call. The steady state file should only be called once per computation of the decision rules.
------------
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: Dynare calls external steady state file twice

Postby twin » Thu Nov 26, 2015 3:43 pm

Sure, I should have been more specific. I'm just trying to call stoch_simul to get the basic output from that. In particular, my code looks like:

Code: Select all
@#include "parameters.mod"

@#include "variables.mod"

model;
@#include "equations.mod"
end;

shocks;
    var aggregateTFPShock = 1;
end;

steady(nocheck);

stoch_simul(order=1,irf=100,hp_filter=1600,relative_irf) aggregateTFP aggregateOutput aggregateInvestment aggregateConsumption aggregateHours wage realInterestRate;


My external steady state file prints "Computing steady state..." whenever its called. The output is:

Using 64-bit preprocessor
...(preprocessing stuff)...
Preprocessing completed.



Computing steady state...... Done! Elapsed time: 37.50 seconds

STEADY-STATE RESULTS:
...(values for endogenous variables in steady state)...

Computing steady state...... Done! Elapsed time: 37.21 seconds


MODEL SUMMARY
...(output of stoch_simul)...


So, the steady state file is called directly before and directly after the STEADY STATE RESULTS output. I'm away for a holiday today, but could also post code for a minimal working example when I get back. Hopefully I'm just missing something basic and you can set me straight. Thanks for your time.
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm

Re: Dynare calls external steady state file twice

Postby jpfeifer » Thu Nov 26, 2015 5:33 pm

The steady-command is only for displaying the steady state. In your case, just leave it out. The call to stoch_simul will compute the steady state required for the decision rules.
------------
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: Dynare calls external steady state file twice

Postby twin » Thu Nov 26, 2015 5:41 pm

Oh I see, that's indeed a basic mistake on my part. Thanks!
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm

Re: Dynare calls external steady state file twice

Postby twin » Wed Jul 27, 2016 7:59 pm

It has been a while but I have a follow up question to this thread. I am trying to solve a model where I have an approximate steady state computed using an external _steadystate.m file. The maximum residual associated with this approximated steady state is on the order of 1e-4, which I am fine with but Dynare is not: it throws up the error "The steadystate file did not compute the steady state" and does not continue with stoch_simul. The only way I know to force Dynare to continue is to call steady(nocheck), which instructs Dynare not to check the steady state residuals, but also forces it to evaluate the external steady state file a second time. The steady state is costly to compute so I would like to avoid this. Is there a way to tell Dynare to ignore the steady state residuals without calling the external steady state file a second time? Thanks!
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm

Re: Dynare calls external steady state file twice

Postby jpfeifer » Thu Jul 28, 2016 6:53 am

I am not following. How can you have a rather big residual with an analytically computed steady state? Overriding Dynare's check for correctness simply because there is a problem with the file is not advocated.
And what do you mean with
also forces it to evaluate the external steady state file a second time
? Which commands are you calling? And why is a second call costly? You should not be looping over full Dynare in any case and the typical Dynare commands you can loop over only call the steady state file once.

There is no reason to call
Code: Select all
steady(nocheck)
just to set
Code: Select all
options_.steadystate.nocheck

You can simply write
Code: Select all
options_.steadystate.nocheck=1

into your mod-file to set this option. An easier way might be to set
Code: Select all
options_.dynatol.f

that is the tolerance for the correctness check. You should use the unstable for this, because there was a problem with the nocheck option.
------------
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: Dynare calls external steady state file twice

Postby twin » Thu Jul 28, 2016 6:03 pm

Thanks Johannes, this is exactly what I am looking for -- I didn't know how to manually control these options, so I was calling steady(nocheck) as a workaround. Thanks for your help.

To clarify: I'm not analytically solving the steady state. I'm approximating it numerically using an external _steadystate.m file. Calling this function is costly because it involves a complicated nonlinear equation, and I would like to be able to control the tolerance with which I solve that equation. I understand that a residual of 1e-4 will introduce numerical error into the solution.
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 8 guests