Skip to content

Commit

Permalink
Fixes for Dynare 6.0
Browse files Browse the repository at this point in the history
- Fix for wrong lengths due to new send to workspace commands (Aguiar_Gopinath_2007)
- Fix for spurious non-positive values from prior which cannot be used in ksdensity (Smets_Wouters_2007_45)
  • Loading branch information
wmutschl committed Mar 7, 2024
1 parent bb6085e commit b5e36c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
9 changes: 7 additions & 2 deletions Aguiar_Gopinath_2007/Aguiar_Gopinath_2007.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

/*
* Copyright (C) 2013-15 Johannes Pfeifer
* Copyright (C) 2013-2024 Johannes Pfeifer
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -169,6 +169,9 @@ log_Gamma_0=0; //Initialize Level of Technology at t=0;
log_Gamma(1,1)=g_eps_g(1,1)+log_Gamma_0; //Level of Tech. after shock in period 1

// reaccumulate the non-stationary level series; note that AG2007 detrend with X_t-1, thus the technology level in the loop is shifted by 1 period
log_y_nonstationary = zeros(options_.irf,1);
log_c_nonstationary = zeros(options_.irf,1);
log_i_nonstationary = zeros(options_.irf,1);
for ii=2:options_.irf
log_Gamma(ii,1)=g_eps_g(ii,1)+log_Gamma(ii-1,1);
log_y_nonstationary(ii,1)=log_y_eps_g(ii,1)+log_Gamma(ii-1,1);
Expand Down Expand Up @@ -215,7 +218,9 @@ log_Gamma_0=0; //Initialize Level of Technology at t=0;
log_Gamma(1,1)=g(1,1)+log_Gamma_0; //Level of Tech. after shock in period 1

// reaccumulate the non-stationary level series

log_y_nonstationary = zeros(options_.periods,1);
log_c_nonstationary = zeros(options_.periods,1);
log_i_nonstationary = zeros(options_.periods,1);
for ii=2:options_.periods
log_Gamma(ii,1)=g(ii,1)+log_Gamma(ii-1,1);
log_y_nonstationary(ii,1)=log_y(ii,1)+log_Gamma(ii-1,1);
Expand Down
10 changes: 8 additions & 2 deletions Smets_Wouters_2007/Smets_Wouters_2007_45.mod
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,14 @@ end;

varobs dy dc dinve labobs pinfobs dw robs;

prior_function(function='PC_slope');
PC_slope_vec=cell2mat(oo_.prior_function_results(:,1));
all_positive = false;
while ~all_positive
prior_function(function='PC_slope');
PC_slope_vec=cell2mat(oo_.prior_function_results(:,1));
if all(PC_slope_vec>0)
all_positive = true;
end
end
[f,xi] = ksdensity(PC_slope_vec,'Support','positive');
figure('Name','Prior Slope of the Phillips Curve')
plot(xi,f);
Expand Down
5 changes: 2 additions & 3 deletions run_all_files.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
clearvars all; clearvars -global;
bad_folders = [];

%% Aguiar_Gopinath_2007
try
Expand Down Expand Up @@ -232,7 +231,7 @@
cd('../Jermann_Quadrini_2012_NK');
dynare Jermann_Quadrini_2012_NK
catch ME
bad_folders = [bad_folders; "Jermann_Quadrini_2012"];
fid = fopen('error.txt', 'w'); fprintf(fid,'%s',ME.message);fclose(fid);
end

%% McCandless_2008
Expand Down Expand Up @@ -270,7 +269,7 @@
dynare RBC_baseline
dynare RBC_baseline_first_diff_bayesian
catch ME
bad_folders = [bad_folders; "RBC_baseline"];
fid = fopen('error.txt', 'w'); fprintf(fid,'%s',ME.message);fclose(fid);
end

%% RBC_baseline_welfare
Expand Down

0 comments on commit b5e36c0

Please sign in to comment.