... | ... | @@ -8,4 +8,107 @@ We most strongly encourage you modify your own code to comply with the new versi |
|
|
|
|
|
## Changes related to Dynare internals
|
|
|
|
|
|
1. List of names have been changed from character arrays to cell arrays of strings. |
|
|
\ No newline at end of file |
|
|
1. List of names have been converted from character arrays to cell arrays of strings. This affects `M_.endo_names`, `M_.exo_names`, `M_.param_names`, `oo_.var_list`, and `options_.varobs`. For that reason, you may have to replace round by curly brackets.
|
|
|
2. In addition, Dynare 4.6 has phased out the use of global variables in user-defined steady state files. Instead, the model structure `M_` and the options-structure `options_` are now passed as input arguments, while the parameter vector `params` has become an output argument.
|
|
|
3. Related to the previous two changes, user-defined steady state files need to be adjusted for i) the interface change related to globals and ii) for the reading out of variables and parameters to be compatible with the cell arrays. In case you are using legacy files, you will generally encounter the error message
|
|
|
|
|
|
> Error using Modelname_steadystate
|
|
|
> Too many input arguments.
|
|
|
>
|
|
|
> Error in evaluate_steady_state_file (line 49)
|
|
|
> [ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);
|
|
|
> and
|
|
|
|
|
|
or
|
|
|
|
|
|
> Error using eval
|
|
|
> Must be a string scalar or character vector.
|
|
|
>
|
|
|
> Error in Model_name_steadystate (line 21)
|
|
|
> eval([ paramname ' = M_.params(' int2str(ii) ');']);
|
|
|
|
|
|
|
|
|
In Dynare 4.5.7, the interface for `_steady_state.m`-files used to be
|
|
|
```matlab
|
|
|
function [ys,check] = NK_baseline_steadystate(ys,exo)
|
|
|
% function [ys,check] = NK_baseline_steadystate(ys,exo)
|
|
|
% computes the steady state for the NK_baseline.mod and uses a numerical
|
|
|
% solver to do so
|
|
|
% Inputs:
|
|
|
% - ys [vector] vector of initial values for the steady state of
|
|
|
% the endogenous variables
|
|
|
% - exo [vector] vector of values for the exogenous variables
|
|
|
%
|
|
|
% Output:
|
|
|
% - ys [vector] vector of steady state values fpr the the endogenous variables
|
|
|
% - check [scalar] set to 0 if steady state computation worked and to
|
|
|
% 1 of not (allows to impos restriction on parameters)
|
|
|
|
|
|
global M_
|
|
|
|
|
|
% read out parameters to access them with their name
|
|
|
NumberOfParameters = M_.param_nbr;
|
|
|
for ii = 1:NumberOfParameters
|
|
|
paramname = deblank(M_.param_names(ii,:));
|
|
|
eval([ paramname ' = M_.params(' int2str(ii) ');']);
|
|
|
end
|
|
|
% initialize indicator
|
|
|
check = 0;
|
|
|
```
|
|
|
In Dynare 4.6 instead the required interface is
|
|
|
|
|
|
```matlab
|
|
|
function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
|
|
% function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
|
|
% computes the steady state for the NK_baseline.mod and uses a numerical
|
|
|
% solver to do so
|
|
|
% Inputs:
|
|
|
% - ys [vector] vector of initial values for the steady state of
|
|
|
% the endogenous variables
|
|
|
% - exo [vector] vector of values for the exogenous variables
|
|
|
% - M_ [structure] Dynare model structure
|
|
|
% - options [structure] Dynare options structure
|
|
|
%
|
|
|
% Output:
|
|
|
% - ys [vector] vector of steady state values for the the endogenous variables
|
|
|
% - params [vector] vector of parameter values
|
|
|
% - check [scalar] set to 0 if steady state computation worked and to
|
|
|
% 1 of not (allows to impose restrictions on parameters)
|
|
|
|
|
|
% read out parameters to access them with their name
|
|
|
NumberOfParameters = M_.param_nbr;
|
|
|
for ii = 1:NumberOfParameters
|
|
|
paramname = M_.param_names{ii};
|
|
|
eval([ paramname ' = M_.params(' int2str(ii) ');']);
|
|
|
end
|
|
|
% initialize indicator
|
|
|
check = 0;
|
|
|
```
|
|
|
Note the interface change in the first line and the use of curly brackets within the loop.
|
|
|
|
|
|
For writing back the steady state to `ys` and the parameters to `params`, the code at the bottom of the steady state file used to be
|
|
|
```
|
|
|
for iter = 1:length(M_.params) %update parameters set in the file
|
|
|
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
|
|
|
end
|
|
|
|
|
|
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
|
|
for ii = 1:NumberOfEndogenousVariables
|
|
|
varname = deblank(M_.endo_names(ii,:));
|
|
|
eval(['ys(' int2str(ii) ') = ' varname ';']);
|
|
|
end
|
|
|
```
|
|
|
It now needs to be replaced by
|
|
|
```
|
|
|
params=NaN(NumberOfParameters,1);
|
|
|
for iter = 1:length(M_.params) %update parameters set in the file
|
|
|
eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
|
|
end
|
|
|
|
|
|
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
|
|
for ii = 1:NumberOfEndogenousVariables
|
|
|
varname = M_.endo_names{ii};
|
|
|
eval(['ys(' int2str(ii) ') = ' varname ';']);
|
|
|
end
|
|
|
```
|
|
|
Note that you now need to span the full parameter vector `params` first and that again curly brackets are used within the loops. |
|
|
\ No newline at end of file |