Fix EOL convention of some files add in 666c9b8003
parent
cd1088904c
commit
44b50d41ae
|
@ -1,166 +1,166 @@
|
|||
function [CheckCO,minnx,minA,minB,minC,minD,dminA,dminB,dminC,dminD] = get_minimal_state_representation(A,B,C,D,dA,dB,dC,dD)
|
||||
% [CheckCO,minnx,minA,minB,minC,minD,dminA,dminB,dminC,dminD] = get_minimal_state_representation(A,B,C,D,dA,dB,dC,dD)
|
||||
% Derives and checks the minimal state representation of the ABCD
|
||||
% representation of a state space model
|
||||
% -------------------------------------------------------------------------
|
||||
% INPUTS
|
||||
% A: [endo_nbr by endo_nbr] Transition matrix from Kalman filter
|
||||
% for all endogenous declared variables, in DR order
|
||||
% B: [endo_nbr by exo_nbr] Transition matrix from Kalman filter
|
||||
% mapping shocks today to endogenous variables today, in DR order
|
||||
% C: [obs_nbr by endo_nbr] Measurement matrix from Kalman filter
|
||||
% linking control/observable variables to states, in DR order
|
||||
% D: [obs_nbr by exo_nbr] Measurement matrix from Kalman filter
|
||||
% mapping shocks today to controls/observables today, in DR order
|
||||
% dA: [endo_nbr by endo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix A
|
||||
% dB: [endo_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix B
|
||||
% dC: [obs_nbr by endo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix C
|
||||
% dD: [obs_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix D
|
||||
% -------------------------------------------------------------------------
|
||||
% OUTPUTS
|
||||
% CheckCO: [scalar] indicator, equals to 1 if minimal state representation is found
|
||||
% minnx: [scalar] length of minimal state vector
|
||||
% minA: [minnx by minnx] Transition matrix A for evolution of minimal state vector
|
||||
% minB: [minnx by exo_nbr] Transition matrix B for evolution of minimal state vector
|
||||
% minC: [obs_nbr by minnx] Measurement matrix C for evolution of controls, depending on minimal state vector only
|
||||
% minD: [obs_nbr by minnx] Measurement matrix D for evolution of controls, depending on minimal state vector only
|
||||
% dminA: [minnx by minnx by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix minA
|
||||
% dminB: [minnx by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix minB
|
||||
% dminC: [obs_nbr by minnx by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix minC
|
||||
% dminD: [obs_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix minD
|
||||
% -------------------------------------------------------------------------
|
||||
% This function is called by
|
||||
% * get_identification_jacobians.m (previously getJJ.m)
|
||||
% -------------------------------------------------------------------------
|
||||
% This function calls
|
||||
% * check_minimality (embedded)
|
||||
% =========================================================================
|
||||
% Copyright (C) 2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
% =========================================================================
|
||||
|
||||
nx = size(A,2);
|
||||
ny = size(C,1);
|
||||
nu = size(B,2);
|
||||
|
||||
% Check controllability and observability conditions for full state vector
|
||||
CheckCO = check_minimality(A,B,C);
|
||||
|
||||
if CheckCO == 1 % If model is already minimal
|
||||
minnx = nx;
|
||||
minA = A;
|
||||
minB = B;
|
||||
minC = C;
|
||||
minD = D;
|
||||
if nargout > 6
|
||||
dminA = dA;
|
||||
dminB = dB;
|
||||
dminC = dC;
|
||||
dminD = dD;
|
||||
end
|
||||
else
|
||||
%Model is not minimal
|
||||
realsmall = 1e-7;
|
||||
% create indices for unnecessary states
|
||||
endogstateindex = find(abs(sum(A,1))<realsmall);
|
||||
exogstateindex = find(abs(sum(A,1))>realsmall);
|
||||
minnx = length(exogstateindex);
|
||||
% remove unnecessary states from solution matrices
|
||||
A_1 = A(endogstateindex,exogstateindex);
|
||||
A_2 = A(exogstateindex,exogstateindex);
|
||||
B_2 = B(exogstateindex,:);
|
||||
C_1 = C(:,endogstateindex);
|
||||
C_2 = C(:,exogstateindex);
|
||||
D = D;
|
||||
ind_A1 = endogstateindex;
|
||||
ind_A2 = exogstateindex;
|
||||
% minimal representation
|
||||
minA = A_2;
|
||||
minB = B_2;
|
||||
minC = C_2;
|
||||
minD = D;
|
||||
% Check controllability and observability conditions
|
||||
CheckCO = check_minimality(minA,minB,minC);
|
||||
|
||||
if CheckCO ~=1
|
||||
j=1;
|
||||
while (CheckCO==0 && j<minnx)
|
||||
combis = nchoosek(1:minnx,j);
|
||||
i=1;
|
||||
while i <= size(combis,1)
|
||||
ind_A2 = exogstateindex;
|
||||
ind_A1 = [endogstateindex ind_A2(combis(j,:))];
|
||||
ind_A2(combis(j,:)) = [];
|
||||
% remove unnecessary states from solution matrices
|
||||
A_1 = A(ind_A1,ind_A2);
|
||||
A_2 = A(ind_A2,ind_A2);
|
||||
B_2 = B(ind_A2,:);
|
||||
C_1 = C(:,ind_A1);
|
||||
C_2 = C(:,ind_A2);
|
||||
D = D;
|
||||
% minimal representation
|
||||
minA = A_2;
|
||||
minB = B_2;
|
||||
minC = C_2;
|
||||
minD = D;
|
||||
% Check controllability and observability conditions
|
||||
CheckCO = check_minimality(minA,minB,minC);
|
||||
if CheckCO == 1
|
||||
minnx = length(ind_A2);
|
||||
break;
|
||||
end
|
||||
i=i+1;
|
||||
end
|
||||
j=j+1;
|
||||
end
|
||||
end
|
||||
if nargout > 6
|
||||
dminA = dA(ind_A2,ind_A2,:);
|
||||
dminB = dB(ind_A2,:,:);
|
||||
dminC = dC(:,ind_A2,:);
|
||||
dminD = dD;
|
||||
end
|
||||
end
|
||||
|
||||
function CheckCO = check_minimality(A,B,C)
|
||||
%% This function computes the controllability and the observability matrices of the ABCD system and checks if the system is minimal
|
||||
%
|
||||
% Inputs: Solution matrices A,B,C of ABCD representation of a DSGE model
|
||||
% Outputs: CheckCO: equals 1, if both rank conditions for observability and controllability are fullfilled
|
||||
n = size(A,1);
|
||||
CC = B; % Initialize controllability matrix
|
||||
OO = C; % Initialize observability matrix
|
||||
if n >= 2
|
||||
for indn = 1:1:n-1
|
||||
CC = [CC, (A^indn)*B]; % Set up controllability matrix
|
||||
OO = [OO; C*(A^indn)]; % Set up observability matrix
|
||||
end
|
||||
end
|
||||
CheckC = (rank(full(CC))==n); % Check rank of controllability matrix
|
||||
CheckO = (rank(full(OO))==n); % Check rank of observability matrix
|
||||
CheckCO = CheckC&CheckO; % equals 1 if minimal state
|
||||
end % check_minimality end
|
||||
|
||||
end % Main function end
|
||||
function [CheckCO,minnx,minA,minB,minC,minD,dminA,dminB,dminC,dminD] = get_minimal_state_representation(A,B,C,D,dA,dB,dC,dD)
|
||||
% [CheckCO,minnx,minA,minB,minC,minD,dminA,dminB,dminC,dminD] = get_minimal_state_representation(A,B,C,D,dA,dB,dC,dD)
|
||||
% Derives and checks the minimal state representation of the ABCD
|
||||
% representation of a state space model
|
||||
% -------------------------------------------------------------------------
|
||||
% INPUTS
|
||||
% A: [endo_nbr by endo_nbr] Transition matrix from Kalman filter
|
||||
% for all endogenous declared variables, in DR order
|
||||
% B: [endo_nbr by exo_nbr] Transition matrix from Kalman filter
|
||||
% mapping shocks today to endogenous variables today, in DR order
|
||||
% C: [obs_nbr by endo_nbr] Measurement matrix from Kalman filter
|
||||
% linking control/observable variables to states, in DR order
|
||||
% D: [obs_nbr by exo_nbr] Measurement matrix from Kalman filter
|
||||
% mapping shocks today to controls/observables today, in DR order
|
||||
% dA: [endo_nbr by endo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix A
|
||||
% dB: [endo_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix B
|
||||
% dC: [obs_nbr by endo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix C
|
||||
% dD: [obs_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix D
|
||||
% -------------------------------------------------------------------------
|
||||
% OUTPUTS
|
||||
% CheckCO: [scalar] indicator, equals to 1 if minimal state representation is found
|
||||
% minnx: [scalar] length of minimal state vector
|
||||
% minA: [minnx by minnx] Transition matrix A for evolution of minimal state vector
|
||||
% minB: [minnx by exo_nbr] Transition matrix B for evolution of minimal state vector
|
||||
% minC: [obs_nbr by minnx] Measurement matrix C for evolution of controls, depending on minimal state vector only
|
||||
% minD: [obs_nbr by minnx] Measurement matrix D for evolution of controls, depending on minimal state vector only
|
||||
% dminA: [minnx by minnx by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix minA
|
||||
% dminB: [minnx by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of transition matrix minB
|
||||
% dminC: [obs_nbr by minnx by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix minC
|
||||
% dminD: [obs_nbr by exo_nbr by totparam_nbr] in DR order
|
||||
% Jacobian (wrt to all parameters) of measurement matrix minD
|
||||
% -------------------------------------------------------------------------
|
||||
% This function is called by
|
||||
% * get_identification_jacobians.m (previously getJJ.m)
|
||||
% -------------------------------------------------------------------------
|
||||
% This function calls
|
||||
% * check_minimality (embedded)
|
||||
% =========================================================================
|
||||
% Copyright (C) 2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
% =========================================================================
|
||||
|
||||
nx = size(A,2);
|
||||
ny = size(C,1);
|
||||
nu = size(B,2);
|
||||
|
||||
% Check controllability and observability conditions for full state vector
|
||||
CheckCO = check_minimality(A,B,C);
|
||||
|
||||
if CheckCO == 1 % If model is already minimal
|
||||
minnx = nx;
|
||||
minA = A;
|
||||
minB = B;
|
||||
minC = C;
|
||||
minD = D;
|
||||
if nargout > 6
|
||||
dminA = dA;
|
||||
dminB = dB;
|
||||
dminC = dC;
|
||||
dminD = dD;
|
||||
end
|
||||
else
|
||||
%Model is not minimal
|
||||
realsmall = 1e-7;
|
||||
% create indices for unnecessary states
|
||||
endogstateindex = find(abs(sum(A,1))<realsmall);
|
||||
exogstateindex = find(abs(sum(A,1))>realsmall);
|
||||
minnx = length(exogstateindex);
|
||||
% remove unnecessary states from solution matrices
|
||||
A_1 = A(endogstateindex,exogstateindex);
|
||||
A_2 = A(exogstateindex,exogstateindex);
|
||||
B_2 = B(exogstateindex,:);
|
||||
C_1 = C(:,endogstateindex);
|
||||
C_2 = C(:,exogstateindex);
|
||||
D = D;
|
||||
ind_A1 = endogstateindex;
|
||||
ind_A2 = exogstateindex;
|
||||
% minimal representation
|
||||
minA = A_2;
|
||||
minB = B_2;
|
||||
minC = C_2;
|
||||
minD = D;
|
||||
% Check controllability and observability conditions
|
||||
CheckCO = check_minimality(minA,minB,minC);
|
||||
|
||||
if CheckCO ~=1
|
||||
j=1;
|
||||
while (CheckCO==0 && j<minnx)
|
||||
combis = nchoosek(1:minnx,j);
|
||||
i=1;
|
||||
while i <= size(combis,1)
|
||||
ind_A2 = exogstateindex;
|
||||
ind_A1 = [endogstateindex ind_A2(combis(j,:))];
|
||||
ind_A2(combis(j,:)) = [];
|
||||
% remove unnecessary states from solution matrices
|
||||
A_1 = A(ind_A1,ind_A2);
|
||||
A_2 = A(ind_A2,ind_A2);
|
||||
B_2 = B(ind_A2,:);
|
||||
C_1 = C(:,ind_A1);
|
||||
C_2 = C(:,ind_A2);
|
||||
D = D;
|
||||
% minimal representation
|
||||
minA = A_2;
|
||||
minB = B_2;
|
||||
minC = C_2;
|
||||
minD = D;
|
||||
% Check controllability and observability conditions
|
||||
CheckCO = check_minimality(minA,minB,minC);
|
||||
if CheckCO == 1
|
||||
minnx = length(ind_A2);
|
||||
break;
|
||||
end
|
||||
i=i+1;
|
||||
end
|
||||
j=j+1;
|
||||
end
|
||||
end
|
||||
if nargout > 6
|
||||
dminA = dA(ind_A2,ind_A2,:);
|
||||
dminB = dB(ind_A2,:,:);
|
||||
dminC = dC(:,ind_A2,:);
|
||||
dminD = dD;
|
||||
end
|
||||
end
|
||||
|
||||
function CheckCO = check_minimality(A,B,C)
|
||||
%% This function computes the controllability and the observability matrices of the ABCD system and checks if the system is minimal
|
||||
%
|
||||
% Inputs: Solution matrices A,B,C of ABCD representation of a DSGE model
|
||||
% Outputs: CheckCO: equals 1, if both rank conditions for observability and controllability are fullfilled
|
||||
n = size(A,1);
|
||||
CC = B; % Initialize controllability matrix
|
||||
OO = C; % Initialize observability matrix
|
||||
if n >= 2
|
||||
for indn = 1:1:n-1
|
||||
CC = [CC, (A^indn)*B]; % Set up controllability matrix
|
||||
OO = [OO; C*(A^indn)]; % Set up observability matrix
|
||||
end
|
||||
end
|
||||
CheckC = (rank(full(CC))==n); % Check rank of controllability matrix
|
||||
CheckO = (rank(full(OO))==n); % Check rank of observability matrix
|
||||
CheckCO = CheckC&CheckO; % equals 1 if minimal state
|
||||
end % check_minimality end
|
||||
|
||||
end % Main function end
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
% =========================================================================
|
||||
% Stochastic growth model of Brock and Mirman (1972) with technology shock
|
||||
% Willi Mutschler, January 2018
|
||||
% willi@mutschler.eu
|
||||
% =========================================================================
|
||||
|
||||
var
|
||||
C ${C}$ (long_name='consumption')
|
||||
K ${K}$ (long_name='capital')
|
||||
A ${Z}$ (long_name='total factor productivity')
|
||||
;
|
||||
varobs C;
|
||||
|
||||
varexo
|
||||
eps_A ${\varepsilon_A}$ (long_name='TFP shock')
|
||||
;
|
||||
|
||||
parameters
|
||||
alph ${\alpha}$ (long_name='capital share')
|
||||
betta ${\beta}$ (long_name='discount factor')
|
||||
rhoA ${\rho_A}$ (long_name='persistence TFP')
|
||||
sigA ${\sigma_A}$ (long_name='standard deviation TFP shock')
|
||||
;
|
||||
|
||||
alph = 0.35;
|
||||
betta = 0.99;
|
||||
rhoA = 0.9;
|
||||
sigA = 0.6;
|
||||
|
||||
model;
|
||||
[name='Euler equation']
|
||||
C^(-1)=alph*betta*C(+1)^(-1)*A(+1)*K^(alph-1);
|
||||
[name='capital law of motion']
|
||||
K=A*K(-1)^alph-C;
|
||||
[name='exogenous TFP process']
|
||||
log(A)=rhoA*log(A(-1))+sigA*eps_A;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var eps_A = 1;
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
A = 1; % technology level
|
||||
K = (alph*betta*A)^(1/(1-alph)); % capital level
|
||||
C = A*K^alph-K; % consumption level
|
||||
end;
|
||||
|
||||
steady; % compute steady state given the starting values
|
||||
resid; % check the starting values for the steady state
|
||||
check; % check Blanchard & Khan rank condition
|
||||
|
||||
@#ifdef kronflag
|
||||
identification(ar=3, useautocorr=1, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=@{kronflag});
|
||||
@#else
|
||||
identification(ar=3, useautocorr=1, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=0);
|
||||
@#endif
|
||||
% =========================================================================
|
||||
% Stochastic growth model of Brock and Mirman (1972) with technology shock
|
||||
% Willi Mutschler, January 2018
|
||||
% willi@mutschler.eu
|
||||
% =========================================================================
|
||||
|
||||
var
|
||||
C ${C}$ (long_name='consumption')
|
||||
K ${K}$ (long_name='capital')
|
||||
A ${Z}$ (long_name='total factor productivity')
|
||||
;
|
||||
varobs C;
|
||||
|
||||
varexo
|
||||
eps_A ${\varepsilon_A}$ (long_name='TFP shock')
|
||||
;
|
||||
|
||||
parameters
|
||||
alph ${\alpha}$ (long_name='capital share')
|
||||
betta ${\beta}$ (long_name='discount factor')
|
||||
rhoA ${\rho_A}$ (long_name='persistence TFP')
|
||||
sigA ${\sigma_A}$ (long_name='standard deviation TFP shock')
|
||||
;
|
||||
|
||||
alph = 0.35;
|
||||
betta = 0.99;
|
||||
rhoA = 0.9;
|
||||
sigA = 0.6;
|
||||
|
||||
model;
|
||||
[name='Euler equation']
|
||||
C^(-1)=alph*betta*C(+1)^(-1)*A(+1)*K^(alph-1);
|
||||
[name='capital law of motion']
|
||||
K=A*K(-1)^alph-C;
|
||||
[name='exogenous TFP process']
|
||||
log(A)=rhoA*log(A(-1))+sigA*eps_A;
|
||||
end;
|
||||
|
||||
shocks;
|
||||
var eps_A = 1;
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
A = 1; % technology level
|
||||
K = (alph*betta*A)^(1/(1-alph)); % capital level
|
||||
C = A*K^alph-K; % consumption level
|
||||
end;
|
||||
|
||||
steady; % compute steady state given the starting values
|
||||
resid; % check the starting values for the steady state
|
||||
check; % check Blanchard & Khan rank condition
|
||||
|
||||
@#ifdef kronflag
|
||||
identification(ar=3, useautocorr=1, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=@{kronflag});
|
||||
@#else
|
||||
identification(ar=3, useautocorr=1, nodisplay, nograph, parameter_set=calibration, analytic_derivation_mode=0);
|
||||
@#endif
|
||||
|
|
|
@ -1,161 +1,161 @@
|
|||
% This is the Clarida, Gali and Gertler Basic New Keynesian model
|
||||
% This mod file illustrates that due to numerical errors and numerical
|
||||
% settings the identification criteria might differ
|
||||
% created by Willi Mutschler (willi@mutschler.eu)
|
||||
var
|
||||
y ${y}$ (long_name='output')
|
||||
c ${c}$ (long_name='consumption')
|
||||
lam ${\lambda}$ (long_name='marginal utility, i.e. lagrange multiplier budget')
|
||||
R ${R}$ (long_name='nominal interest rate')
|
||||
pie ${\pi}$ (long_name='inflation rate')
|
||||
n ${n}$ (long_name='labor')
|
||||
w ${w}$ (long_name='real wage')
|
||||
mc ${mc}$ (long_name='marginal costs')
|
||||
pstar ${p^\ast}$ (long_name='price dispersion')
|
||||
ptilde ${\tilde{p}}$ (long_name='reoptimized price')
|
||||
S1 ${S_{1}}$ (long_name='auxiliary variable for nonlinear pricing 1')
|
||||
S2 ${S_{2}}$ (long_name='auxiliary variable for nonlinear pricing 2')
|
||||
a ${a}$ (long_name='total factor productivity')
|
||||
RR ${R^{**}}$ (long_name='natural interest rate')
|
||||
yy ${y^{**}}$ (long_name='natural output')
|
||||
x ${x}$ (long_name='output gap')
|
||||
da ${\delta a}$ (long_name='technology growth')
|
||||
;
|
||||
|
||||
varexo
|
||||
epsa ${\varepsilon^A}$ (long_name='TFP shock')
|
||||
epsR ${\varepsilon^R}$ (long_name='monetary policy shock')
|
||||
;
|
||||
|
||||
parameters
|
||||
BETA ${\beta}$ (long_name='discount factor')
|
||||
PIESTAR ${\pi^\ast}$ (long_name='annual target inflation rate')
|
||||
PSIPIE ${\psi_\pi}$ (long_name='Taylor rule parameter inflation')
|
||||
PSIY ${\psi_y}$ (long_name='Taylor rule parameter output')
|
||||
RHOR ${\rho_R}$ (long_name='persistence Taylor rule')
|
||||
SIGR ${\sigma_R}$ (long_name='standard deviation monetary policy shock')
|
||||
ETA ${\eta}$ (long_name='elasticity of substitution')
|
||||
THETA ${\theta}$ (long_name='Calvo probability of resetting prices')
|
||||
PSI ${\psi}$ (long_name='labor disutility parameter')
|
||||
RHOA ${\rho_A}$ (long_name='persistence TFP')
|
||||
SIGA ${\sigma_A}$ (long_name='standard deviation TFP shock')
|
||||
SUBSIDY ${\nu}$ (long_name='subsidy')
|
||||
;
|
||||
|
||||
%Calibration
|
||||
BETA = 0.99;
|
||||
PIESTAR = 1;
|
||||
PSIPIE = 1.5;
|
||||
PSIY = 0;
|
||||
RHOR = 0;
|
||||
SIGR = 0.2;
|
||||
ETA = 2;
|
||||
THETA = 3/4;
|
||||
PSI = 1;
|
||||
RHOA = 0.5;
|
||||
SIGA = 0.01;
|
||||
SUBSIDY = 1 - (ETA-1)/ETA;
|
||||
|
||||
model;
|
||||
|
||||
[name='marginal utility of consumption']
|
||||
lam = 1/c;
|
||||
|
||||
[name='Euler equation']
|
||||
lam = BETA*R/pie(+1)*lam(+1);
|
||||
|
||||
[name='labor supply']
|
||||
lam*w = n^PSI;
|
||||
|
||||
[name='aggregate supply']
|
||||
pstar*y = a*n;
|
||||
|
||||
[name='labor demand']
|
||||
w*(1-SUBSIDY) = mc*a;
|
||||
|
||||
[name='market clearing']
|
||||
y = c;
|
||||
|
||||
[name='recursive Price']
|
||||
ptilde*S1 = ETA/(ETA-1)*S2;
|
||||
|
||||
[name='recursive Price 1']
|
||||
S1 = y + THETA*BETA*lam(+1)/lam*pie(+1)^(ETA-1)*S1(+1);
|
||||
|
||||
[name='recursive Price 2']
|
||||
S2 = y*mc + THETA*BETA*lam(+1)/lam*pie(+1)^(ETA)*S2(+1);
|
||||
|
||||
[name='aggregate price index']
|
||||
1 = (1-THETA)*ptilde^(1-ETA) + THETA*pie^(ETA-1);
|
||||
|
||||
[name='overall price dispersion']
|
||||
pstar = (1-THETA)*ptilde^(-ETA) + THETA*pie^(ETA)*pstar(-1);
|
||||
|
||||
[name='Taylor rule']
|
||||
R = steady_state(R)^(1-RHOR)*R(-1)^RHOR*(pie/PIESTAR)^PSIPIE*(y/steady_state(y))^PSIY*exp(epsR);
|
||||
|
||||
[name='evolution of technology']
|
||||
log(a) = RHOA*log(a(-1)) + epsa;
|
||||
|
||||
[name='technology growth']
|
||||
da = log(a/a(-1));
|
||||
|
||||
[name='efficient interest rate']
|
||||
RR = 1/BETA * a(+1)/a;
|
||||
|
||||
[name='efficient output']
|
||||
yy = a;
|
||||
|
||||
[name='output gap']
|
||||
x = (y-yy);
|
||||
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
a = 1;
|
||||
da = 0;
|
||||
pie = PIESTAR;
|
||||
R = pie/BETA;
|
||||
ptilde = ( (1-THETA*pie^(ETA-1))/ (1-THETA) )^(1/(1-ETA));
|
||||
pstar = ( (1-THETA) / (1-THETA*pie^(ETA)) )*ptilde^(-ETA);
|
||||
mc = (ETA-1)/ETA*ptilde* (1-THETA*BETA*pie^(ETA)) / (1-THETA*BETA*pie^(ETA-1));
|
||||
w = 1/(1-SUBSIDY)*mc*a;
|
||||
n = (pstar*mc/(1-SUBSIDY))^(1/(PSI+1));
|
||||
y = pstar^(-1)*a*n;
|
||||
c = y;
|
||||
lam = 1/c;
|
||||
S1 = y/(1-THETA*BETA*pie^(ETA-1));
|
||||
S2 = y*mc/(1-THETA*BETA*pie^(ETA));
|
||||
RR = 1/BETA;
|
||||
yy = a;
|
||||
x = y-yy;
|
||||
end;
|
||||
|
||||
|
||||
shocks;
|
||||
var epsa = SIGA^2;
|
||||
var epsR = SIGR^2;
|
||||
end;
|
||||
|
||||
|
||||
model_diagnostics;
|
||||
steady;
|
||||
resid;
|
||||
check;
|
||||
|
||||
estimated_params;
|
||||
PIESTAR , 1;
|
||||
PSIPIE , 1.5;
|
||||
PSIY , 0;
|
||||
RHOR , 0;
|
||||
ETA , 1.5;
|
||||
end;
|
||||
|
||||
varobs y c;
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=0, checks_via_subsets=0);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=1, checks_via_subsets=0);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=0, checks_via_subsets=1);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=1, checks_via_subsets=1);
|
||||
|
||||
estim_params_ = [];
|
||||
identification(checks_via_subsets=1, max_dim_subsets_groups=4);
|
||||
% This is the Clarida, Gali and Gertler Basic New Keynesian model
|
||||
% This mod file illustrates that due to numerical errors and numerical
|
||||
% settings the identification criteria might differ
|
||||
% created by Willi Mutschler (willi@mutschler.eu)
|
||||
var
|
||||
y ${y}$ (long_name='output')
|
||||
c ${c}$ (long_name='consumption')
|
||||
lam ${\lambda}$ (long_name='marginal utility, i.e. lagrange multiplier budget')
|
||||
R ${R}$ (long_name='nominal interest rate')
|
||||
pie ${\pi}$ (long_name='inflation rate')
|
||||
n ${n}$ (long_name='labor')
|
||||
w ${w}$ (long_name='real wage')
|
||||
mc ${mc}$ (long_name='marginal costs')
|
||||
pstar ${p^\ast}$ (long_name='price dispersion')
|
||||
ptilde ${\tilde{p}}$ (long_name='reoptimized price')
|
||||
S1 ${S_{1}}$ (long_name='auxiliary variable for nonlinear pricing 1')
|
||||
S2 ${S_{2}}$ (long_name='auxiliary variable for nonlinear pricing 2')
|
||||
a ${a}$ (long_name='total factor productivity')
|
||||
RR ${R^{**}}$ (long_name='natural interest rate')
|
||||
yy ${y^{**}}$ (long_name='natural output')
|
||||
x ${x}$ (long_name='output gap')
|
||||
da ${\delta a}$ (long_name='technology growth')
|
||||
;
|
||||
|
||||
varexo
|
||||
epsa ${\varepsilon^A}$ (long_name='TFP shock')
|
||||
epsR ${\varepsilon^R}$ (long_name='monetary policy shock')
|
||||
;
|
||||
|
||||
parameters
|
||||
BETA ${\beta}$ (long_name='discount factor')
|
||||
PIESTAR ${\pi^\ast}$ (long_name='annual target inflation rate')
|
||||
PSIPIE ${\psi_\pi}$ (long_name='Taylor rule parameter inflation')
|
||||
PSIY ${\psi_y}$ (long_name='Taylor rule parameter output')
|
||||
RHOR ${\rho_R}$ (long_name='persistence Taylor rule')
|
||||
SIGR ${\sigma_R}$ (long_name='standard deviation monetary policy shock')
|
||||
ETA ${\eta}$ (long_name='elasticity of substitution')
|
||||
THETA ${\theta}$ (long_name='Calvo probability of resetting prices')
|
||||
PSI ${\psi}$ (long_name='labor disutility parameter')
|
||||
RHOA ${\rho_A}$ (long_name='persistence TFP')
|
||||
SIGA ${\sigma_A}$ (long_name='standard deviation TFP shock')
|
||||
SUBSIDY ${\nu}$ (long_name='subsidy')
|
||||
;
|
||||
|
||||
%Calibration
|
||||
BETA = 0.99;
|
||||
PIESTAR = 1;
|
||||
PSIPIE = 1.5;
|
||||
PSIY = 0;
|
||||
RHOR = 0;
|
||||
SIGR = 0.2;
|
||||
ETA = 2;
|
||||
THETA = 3/4;
|
||||
PSI = 1;
|
||||
RHOA = 0.5;
|
||||
SIGA = 0.01;
|
||||
SUBSIDY = 1 - (ETA-1)/ETA;
|
||||
|
||||
model;
|
||||
|
||||
[name='marginal utility of consumption']
|
||||
lam = 1/c;
|
||||
|
||||
[name='Euler equation']
|
||||
lam = BETA*R/pie(+1)*lam(+1);
|
||||
|
||||
[name='labor supply']
|
||||
lam*w = n^PSI;
|
||||
|
||||
[name='aggregate supply']
|
||||
pstar*y = a*n;
|
||||
|
||||
[name='labor demand']
|
||||
w*(1-SUBSIDY) = mc*a;
|
||||
|
||||
[name='market clearing']
|
||||
y = c;
|
||||
|
||||
[name='recursive Price']
|
||||
ptilde*S1 = ETA/(ETA-1)*S2;
|
||||
|
||||
[name='recursive Price 1']
|
||||
S1 = y + THETA*BETA*lam(+1)/lam*pie(+1)^(ETA-1)*S1(+1);
|
||||
|
||||
[name='recursive Price 2']
|
||||
S2 = y*mc + THETA*BETA*lam(+1)/lam*pie(+1)^(ETA)*S2(+1);
|
||||
|
||||
[name='aggregate price index']
|
||||
1 = (1-THETA)*ptilde^(1-ETA) + THETA*pie^(ETA-1);
|
||||
|
||||
[name='overall price dispersion']
|
||||
pstar = (1-THETA)*ptilde^(-ETA) + THETA*pie^(ETA)*pstar(-1);
|
||||
|
||||
[name='Taylor rule']
|
||||
R = steady_state(R)^(1-RHOR)*R(-1)^RHOR*(pie/PIESTAR)^PSIPIE*(y/steady_state(y))^PSIY*exp(epsR);
|
||||
|
||||
[name='evolution of technology']
|
||||
log(a) = RHOA*log(a(-1)) + epsa;
|
||||
|
||||
[name='technology growth']
|
||||
da = log(a/a(-1));
|
||||
|
||||
[name='efficient interest rate']
|
||||
RR = 1/BETA * a(+1)/a;
|
||||
|
||||
[name='efficient output']
|
||||
yy = a;
|
||||
|
||||
[name='output gap']
|
||||
x = (y-yy);
|
||||
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
a = 1;
|
||||
da = 0;
|
||||
pie = PIESTAR;
|
||||
R = pie/BETA;
|
||||
ptilde = ( (1-THETA*pie^(ETA-1))/ (1-THETA) )^(1/(1-ETA));
|
||||
pstar = ( (1-THETA) / (1-THETA*pie^(ETA)) )*ptilde^(-ETA);
|
||||
mc = (ETA-1)/ETA*ptilde* (1-THETA*BETA*pie^(ETA)) / (1-THETA*BETA*pie^(ETA-1));
|
||||
w = 1/(1-SUBSIDY)*mc*a;
|
||||
n = (pstar*mc/(1-SUBSIDY))^(1/(PSI+1));
|
||||
y = pstar^(-1)*a*n;
|
||||
c = y;
|
||||
lam = 1/c;
|
||||
S1 = y/(1-THETA*BETA*pie^(ETA-1));
|
||||
S2 = y*mc/(1-THETA*BETA*pie^(ETA));
|
||||
RR = 1/BETA;
|
||||
yy = a;
|
||||
x = y-yy;
|
||||
end;
|
||||
|
||||
|
||||
shocks;
|
||||
var epsa = SIGA^2;
|
||||
var epsR = SIGR^2;
|
||||
end;
|
||||
|
||||
|
||||
model_diagnostics;
|
||||
steady;
|
||||
resid;
|
||||
check;
|
||||
|
||||
estimated_params;
|
||||
PIESTAR , 1;
|
||||
PSIPIE , 1.5;
|
||||
PSIY , 0;
|
||||
RHOR , 0;
|
||||
ETA , 1.5;
|
||||
end;
|
||||
|
||||
varobs y c;
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=0, checks_via_subsets=0);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=1, checks_via_subsets=0);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=0, checks_via_subsets=1);
|
||||
identification(tol_rank=1e-13, tol_sv=1e-2, tol_deriv=1e-6, normalize_jacobians=1, checks_via_subsets=1);
|
||||
|
||||
estim_params_ = [];
|
||||
identification(checks_via_subsets=1, max_dim_subsets_groups=4);
|
||||
|
|
Loading…
Reference in New Issue