Remove global variables from user-defined steady state files
M_ and options_ are now passed as an input; params is an output as in the _steadystate2.m filestime-shift
parent
fc6c78e5ea
commit
0c01c31491
|
@ -1,19 +1,20 @@
|
||||||
function [ys,check] = NK_baseline_steadystate(ys,exo)
|
function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
||||||
% function [ys,check] = NK_baseline_steadystate(ys,exo)
|
% function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
||||||
% computes the steady state for the NK_baseline.mod and uses a numerical
|
% computes the steady state for the NK_baseline.mod and uses a numerical
|
||||||
% solver to do so
|
% solver to do so
|
||||||
% Inputs:
|
% Inputs:
|
||||||
% - ys [vector] vector of initial values for the steady state of
|
% - ys [vector] vector of initial values for the steady state of
|
||||||
% the endogenous variables
|
% the endogenous variables
|
||||||
% - exo [vector] vector of values for the exogenous variables
|
% - exo [vector] vector of values for the exogenous variables
|
||||||
|
% - M_ [structure] Dynare model structure
|
||||||
|
% - options [structure] Dynare options structure
|
||||||
%
|
%
|
||||||
% Output:
|
% Output:
|
||||||
% - ys [vector] vector of steady state values for the the endogenous variables
|
% - 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
|
% - check [scalar] set to 0 if steady state computation worked and to
|
||||||
% 1 of not (allows to impose restrictions on parameters)
|
% 1 of not (allows to impose restrictions on parameters)
|
||||||
|
|
||||||
global M_
|
|
||||||
|
|
||||||
% read out parameters to access them with their name
|
% read out parameters to access them with their name
|
||||||
NumberOfParameters = M_.param_nbr;
|
NumberOfParameters = M_.param_nbr;
|
||||||
for ii = 1:NumberOfParameters
|
for ii = 1:NumberOfParameters
|
||||||
|
@ -95,8 +96,9 @@ g2=epsilon/(epsilon-1)*g1;
|
||||||
|
|
||||||
%% end own model equations
|
%% end own model equations
|
||||||
|
|
||||||
|
params=NaN(NumberOfParameters,1);
|
||||||
for iter = 1:length(M_.params) %update parameters set in the file
|
for iter = 1:length(M_.params) %update parameters set in the file
|
||||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||||
end
|
end
|
||||||
|
|
||||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||||
|
|
|
@ -46,8 +46,7 @@ if options.steadystate_flag == 1
|
||||||
assignin('base','tmp_00_',params);
|
assignin('base','tmp_00_',params);
|
||||||
evalin('base','M_.params=tmp_00_; clear(''tmp_00_'')');
|
evalin('base','M_.params=tmp_00_; clear(''tmp_00_'')');
|
||||||
h_steadystate = str2func([fname '_steadystate']);
|
h_steadystate = str2func([fname '_steadystate']);
|
||||||
[ys,check] = h_steadystate(ys_init, exo_ss);
|
[ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);
|
||||||
params1 = evalin('base','M_.params');
|
|
||||||
else % steadystate_flag == 2
|
else % steadystate_flag == 2
|
||||||
% new format
|
% new format
|
||||||
h_steadystate = str2func([fname '.steadystate']);
|
h_steadystate = str2func([fname '.steadystate']);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
function [ys_, check_] = expectation_ss_old_steadystate(ys_orig_, exo_)
|
function [ys_, params, check_] = expectation_ss_old_steadystate(ys_orig_, exo_,M_,options_)
|
||||||
ys_=zeros(6,1);
|
ys_=zeros(6,1);
|
||||||
global M_
|
params=NaN(size(M_.params));
|
||||||
|
params=M_.params;
|
||||||
ys_(4)=0;
|
ys_(4)=0;
|
||||||
ys_(6)=0;
|
ys_(6)=0;
|
||||||
ys_(5)=0.3333333333333333;
|
ys_(5)=0.3333333333333333;
|
||||||
ys_(3)=((1/M_.params(1)-(1-M_.params(4)))/(M_.params(3)*ys_(5)^(1-M_.params(3))))^(1/(M_.params(3)-1));
|
ys_(3)=((1/M_.params(1)-(1-M_.params(4)))/(M_.params(3)*ys_(5)^(1-M_.params(3))))^(1/(M_.params(3)-1));
|
||||||
ys_(1)=ys_(5)^(1-M_.params(3))*ys_(3)^M_.params(3);
|
ys_(1)=ys_(5)^(1-M_.params(3))*ys_(3)^M_.params(3);
|
||||||
ys_(2)=ys_(1)-M_.params(4)*ys_(3);
|
ys_(2)=ys_(1)-M_.params(4)*ys_(3);
|
||||||
M_.params(5)=(1-M_.params(3))*ys_(1)/(ys_(2)*ys_(5)^(1+M_.params(6)));
|
params(5)=(1-M_.params(3))*ys_(1)/(ys_(2)*ys_(5)^(1+M_.params(6)));
|
||||||
check_=0;
|
check_=0;
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
function [ys,check] = walsh1_old_ss_steadystate(ys,exo)
|
function [ys,params,check] = walsh1_old_ss_steadystate(ys,exo,M_,options_)
|
||||||
global M_
|
|
||||||
|
|
||||||
% read out parameters to access them with their name
|
% read out parameters to access them with their name
|
||||||
NumberOfParameters = M_.param_nbr;
|
NumberOfParameters = M_.param_nbr;
|
||||||
|
@ -34,8 +33,9 @@ check = 0;
|
||||||
|
|
||||||
%% end own model equations
|
%% end own model equations
|
||||||
|
|
||||||
for iter = 1:length(M_.params) %update parameters set in the file
|
params=NaN(NumberOfParameters,1);
|
||||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
for iter = 1:NumberOfParameters %update parameters set in the file
|
||||||
|
eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||||
end
|
end
|
||||||
|
|
||||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||||
|
|
Loading…
Reference in New Issue