Thanks Marco for finding this tricky bug.
It is a complicated issue that stems from two poor design decisions: 1) using the global variable oo_.steady_state in *_dynamic.m 2) an unclear distinction between oo_.steady_state and dr.ys: the rule that I had in mind was - oo_.steady_state is set by instructions initval and steady - dr.ys is the steady state computed for local approximation But this is not good enough and as you found out creates problem for steady_state operator
What makes the problem complicated is that the solution must work both for the simulation of deterministic models where dr.ys is not computed and for the (repeated, in estimation) local approximation of stochastic model where oo_.steady_state is currently not updated for new values of the parameters.
A temporary fix is to set oo_.steady_state in resol.m. I will make that change and update to GIT today.
In the long run, we have to find a way to pass the steady state values to *_dynamic.m as an argument and not as a global
Best
Michel
On 3/8/2011 9:54 PM, Marco Ratto wrote:
Dear Friends,
playing quite intensively with a model including the STEADY_STATE syntax in model definition, I stepped into a subtle bug:
when dynare_resolve is called, the resol routine checks if ys is the steady state, if not it re/computes it and updates dr.ys and oo_.dr.ys. However, oo_.steady_state is not updated and the latter is used in <model>_dynamic.m. This implies a wrong model solution. In order to fix it I would simply update oo_.steady_state before calling dr1 or dr_block in resol.m. Otherwise, if there is a reason why only dr.ys should be kept updated laving oo_.steady_state as it is now, then the pre-processor has to be changed and the use of oo_.steady_state in _dynamic and param_derivs files should be replaced by oo_.dr.ys.
Just let me know how I should proceed. Many thanks for your help best Marco
Hi Just a little warning, passing SS to *_dynamic.mex*** when using DLL also needs to be added. Brgds George
________________________________
Fra: dev-bounces@dynare.org på vegne af Michel Juillard Sendt: on 09/03/2011 09:44 Til: Marco Ratto; List for Dynare developers Emne: Re: [DynareDev] bug in resol
Thanks Marco for finding this tricky bug.
It is a complicated issue that stems from two poor design decisions: 1) using the global variable oo_.steady_state in *_dynamic.m 2) an unclear distinction between oo_.steady_state and dr.ys: the rule that I had in mind was - oo_.steady_state is set by instructions initval and steady - dr.ys is the steady state computed for local approximation But this is not good enough and as you found out creates problem for steady_state operator
What makes the problem complicated is that the solution must work both for the simulation of deterministic models where dr.ys is not computed and for the (repeated, in estimation) local approximation of stochastic model where oo_.steady_state is currently not updated for new values of the parameters.
A temporary fix is to set oo_.steady_state in resol.m. I will make that change and update to GIT today.
In the long run, we have to find a way to pass the steady state values to *_dynamic.m as an argument and not as a global
Best
Michel
On 3/8/2011 9:54 PM, Marco Ratto wrote:
Dear Friends,
playing quite intensively with a model including the STEADY_STATE syntax in model definition, I stepped into a subtle bug:
when dynare_resolve is called, the resol routine checks if ys is the steady state, if not it re/computes it and updates dr.ys and oo_.dr.ys. However, oo_.steady_state is not updated and the latter is used in <model>_dynamic.m. This implies a wrong model solution. In order to fix it I would simply update oo_.steady_state before calling dr1 or dr_block in resol.m. Otherwise, if there is a reason why only dr.ys should be kept updated laving oo_.steady_state as it is now, then the pre-processor has to be changed and the use of oo_.steady_state in _dynamic and param_derivs files should be replaced by oo_.dr.ys.
Just let me know how I should proceed. Many thanks for your help best Marco
_______________________________________________ Dev mailing list Dev@dynare.org https://www.dynare.org/cgi-bin/mailman/listinfo/dev
OK, thanks a lot! MAy I just add that the same way of passing steady state to *_dynamic should be ported to *_params_derivs.
All the best Marco
On 3/9/2011 10:44 AM, Michel Juillard wrote:
Thanks Marco for finding this tricky bug.
It is a complicated issue that stems from two poor design decisions:
- using the global variable oo_.steady_state in *_dynamic.m
- an unclear distinction between oo_.steady_state and dr.ys: the rule
that I had in mind was
- oo_.steady_state is set by instructions initval and steady
- dr.ys is the steady state computed for local approximation
But this is not good enough and as you found out creates problem for steady_state operator
What makes the problem complicated is that the solution must work both for the simulation of deterministic models where dr.ys is not computed and for the (repeated, in estimation) local approximation of stochastic model where oo_.steady_state is currently not updated for new values of the parameters.
A temporary fix is to set oo_.steady_state in resol.m. I will make that change and update to GIT today.
In the long run, we have to find a way to pass the steady state values to *_dynamic.m as an argument and not as a global
Best
Michel
On 3/8/2011 9:54 PM, Marco Ratto wrote:
Dear Friends,
playing quite intensively with a model including the STEADY_STATE syntax in model definition, I stepped into a subtle bug:
when dynare_resolve is called, the resol routine checks if ys is the steady state, if not it re/computes it and updates dr.ys and oo_.dr.ys. However, oo_.steady_state is not updated and the latter is used in <model>_dynamic.m. This implies a wrong model solution. In order to fix it I would simply update oo_.steady_state before calling dr1 or dr_block in resol.m. Otherwise, if there is a reason why only dr.ys should be kept updated laving oo_.steady_state as it is now, then the pre-processor has to be changed and the use of oo_.steady_state in _dynamic and param_derivs files should be replaced by oo_.dr.ys.
Just let me know how I should proceed. Many thanks for your help best Marco