-
Notifications
You must be signed in to change notification settings - Fork 0
/
RBC_newsshock_steadystate.m
39 lines (36 loc) · 1.38 KB
/
RBC_newsshock_steadystate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function [ys,params,check] = RBC_newsshock_steadystate(ys,exo,M_,options_)
% 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] 0 if steady state computation worked and to
% 1 of not (allows to impose restrictions on parameters)
check=0;
%% Step 1: read out parameters to access them with their name
for ii = 1:M_.param_nbr
eval([ M_.param_names{ii} ' = M_.params(' int2str(ii) ');']);
end
%% Step 2: Enter model equations here
g=gs;
thet=1;
l=1/3;
y_k=(g^(1/alph)/bet+delt-1)/(1-alph)*g^(-1/alph);
k=(y_k*g^((1-alph)/alph))^(-1/alph)*l;
i=(1-(1-delt)*g^(-1/alph))*k;
y=y_k*k;
c=y-i;
v0=alph/c*y/l;
%% Step 3: Update parameters and variables
params=NaN(M_.param_nbr,1);
for iter = 1:M_.param_nbr %update parameters set in the file
eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
end
for ii = 1:M_.orig_endo_nbr %auxiliary variables are set automatically
eval(['ys(' int2str(ii) ') = ' M_.endo_names{ii} ';']);
end
end