Merge branch 'master' into ecb-master

time-shift
Houtan Bastani 2018-06-07 18:47:36 +02:00
commit e9c631de7d
21 changed files with 60 additions and 59 deletions

View File

@ -74,8 +74,11 @@ periods 1;
values 1.2;
end;
// Deterministic simulation of the model for 200 periods
simul(periods=200);
// Prepare the deterministic simulation of the model over 200 periods
perfect_foresight_setup(periods=200);
// Perform the simulation
perfect_foresight_solver;
// Display the path of consumption and capital
rplot c;

View File

@ -143,23 +143,24 @@ Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
License: GPL-3+
Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m
matlab/missing/stats/common_size.m matlab/missing/stats/chi2inv.m
matlab/missing/stats/chi2inv.m
matlab/missing/stats/gaminv.m matlab/missing/stats/gampdf.m
matlab/missing/stats/stdnormal_inv.m matlab/missing/stats/betacdf.m
matlab/missing/stats/betapdf.m matlab/missing/stats/normcdf.m
matlab/missing/stats/stdnormal_cdf.m matlab/missing/stats/norminv.m
matlab/missing/stats/stdnormal_pdf.m matlab/missing/stats/betainv.m
matlab/missing/stats-matlab/common_size.m
Copyright: 1995-2007 Kurt Hornik
2008-2011 Dynare Team
License: GPL-3+
Files: matlab/missing/stats/quantile.m
Files: matlab/missing/stats-matlab/quantile.m
Copyright: 2014-2016 Christopher Hummersone
2016 Dynare Team
License: GPL-3+
Files: matlab/missing/stats/corr.m
Files: matlab/missing/stats-matlab/corr.m
Copyright: 1993-1996 Kurt Hornik
1996-2015 John W. Eaton
2013-2015 Julien Bect

View File

@ -71,16 +71,23 @@ dynareroot = dynare_config('', preprocessoroutput);
warning_config()
if isoctave
if octave_ver_less_than(supported_octave_version)
% The supported_octave_version.m file is not in git nor in the source
% package, it is manually added in binary packages distributed on dynare.org
if exist('supported_octave_version', 'file') && ~strcmp(supported_octave_version, version)
skipline()
warning(['This version of Octave is not supported. Consider installing ' ...
'version %s+ of Octave,\notherwise m files will be used instead ' ...
'of precompiled mex files and some features, like solution\n' ...
'version %s of Octave\n' ...
'from www.octave.org, otherwise m files will be used instead ' ...
'of precompiled mex files and some\nfeatures, like solution ' ...
'of models approximated at third order, will not be available.'], supported_octave_version())
skipline()
elseif octave_ver_less_than('4.2') % Should match the test in mex/build/octave/configure.ac
skipline()
warning(['This version of Dynare has only been tested on Octave 4.2 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.'])
skipline()
end
else
if matlab_ver_less_than('7.5')
if matlab_ver_less_than('7.5') % Should match the test in mex/build/matlab/configure.ac
skipline()
warning('This version of Dynare has only been tested on MATLAB 7.5 (R2007b) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.');
skipline()

View File

@ -79,16 +79,11 @@ p = {'/distributions/' ; ...
% For functions that exist only under some Octave versions
% or some MATLAB versions, and for which we provide some replacement functions
% Replacements for rows(), columns(), vec() and issquare() (inexistent under MATLAB)
if ~isoctave
% Replacements for rows(), columns() and issquare() (inexistent under MATLAB)
p{end+1} = '/missing/rows_columns';
p{end+1} = '/missing/issquare';
% Replacement for vec() (inexistent under MATLAB)
p{end+1} = '/missing/vec';
if ~user_has_matlab_license('statistics_toolbox')
% Replacements for functions of the stats toolbox
p{end+1} = '/missing/stats/';
end
end
% ordeig() doesn't exist in Octave
@ -108,6 +103,16 @@ if (isoctave && ~user_has_octave_forge_package('statistics')) ...
p{end+1} = '/missing/nanmean';
end
% Replacements for functions of the MATLAB statistics toolbox
% These functions were part of Octave < 4.4, they are now in the statistics Forge package
if (isoctave && ~octave_ver_less_than('4.4') && ~user_has_octave_forge_package('statistics')) ...
|| (~isoctave && ~user_has_matlab_license('statistics_toolbox'))
p{end+1} = '/missing/stats/';
if ~isoctave
p{end+1} = '/missing/stats-matlab/';
end
end
% Check if struct2array is available.
if ~exist('struct2array')
p{end+1} = '/missing/struct2array';

View File

@ -102,6 +102,7 @@ if info(1)==0
derivatives_info.DOm=dOm;
derivatives_info.DYss=dYss;
options_.ar=nlags;
options_ident.ar=nlags;
indJJ = (find(max(abs(JJ'),[],1)>1.e-8));
end
if length(indJJ)<nparam

@ -1 +1 @@
Subproject commit bdf42bec7bda894e2591d8bebb9fe25423ada4f7
Subproject commit 2bebeef16f87f215f4c1fed510e243f82dbd67aa

View File

@ -135,11 +135,7 @@ switch minimizer_algorithm
simulated_annealing(objective_function,start_par_value,sa_options,LB,UB,varargin{:});
case 3
if isoctave && ~user_has_octave_forge_package('optim')
try
pkg load optim
catch
error('Optimization algorithm 3 requires the optim package')
end
error('Optimization algorithm 3 requires the optim package')
elseif ~isoctave && ~user_has_matlab_license('optimization_toolbox')
error('Optimization algorithm 3 requires the Optimization Toolbox')
end

View File

@ -55,9 +55,9 @@ for it = maximum_lag+(1:T)
z(jexog) = transpose(exo_simul(it,:));
residuals(i_rows) = dynamicjacobian*z;
if nargout == 2
if it == 2
if it == maximum_lag+1
JJacobian(i_rows,i_cols_J1) = dynamicjacobian(:,i_cols_1);
elseif it == T + 1
elseif it == maximum_lag+T
JJacobian(i_rows,i_cols_J(i_cols_T)) = dynamicjacobian(:,i_cols_T);
else
JJacobian(i_rows,i_cols_J) = dynamicjacobian(:,i_cols_j);

View File

@ -74,7 +74,7 @@ i_rows = 1:ny;
offset = 0;
i_cols_J = i_cols;
for it = 2:(T+1)
for it = maximum_lag+(1:T)
if nargout == 1
res = dynamic_function(YY(i_cols),exo_simul, params, ...
steady_state,it);
@ -83,15 +83,15 @@ for it = 2:(T+1)
[res,jacobian] = dynamic_function(YY(i_cols),exo_simul, params, ...
steady_state,it);
residuals(i_rows) = res(eq_index);
if it == 2
if it == maximum_lag+1
[rows,cols,vals] = find(jacobian(eq_index,i_cols_1));
iJacobian{1} = [offset+rows, i_cols_J1(cols), vals];
elseif it == T + 1
elseif it == maximum_lag+T
[rows,cols,vals] = find(jacobian(eq_index,i_cols_T));
iJacobian{T} = [offset+rows, i_cols_J(i_cols_T(cols)), vals];
else
[rows,cols,vals] = find(jacobian(eq_index,i_cols_j));
iJacobian{it-1} = [offset+rows, i_cols_J(cols), vals];
iJacobian{it-maximum_lag} = [offset+rows, i_cols_J(cols), vals];
i_cols_J = i_cols_J + ny;
end
offset = offset + ny;

View File

@ -71,22 +71,22 @@ i_rows = 1:ny;
i_cols_J = i_cols;
offset = 0;
for it = 2:(T+1)
for it = maximum_lag+(1:T)
if nargout == 1
residuals(i_rows) = dynamic_function(YY(i_cols),exo_simul, params, ...
steady_state,it);
elseif nargout == 2
[residuals(i_rows),jacobian] = dynamic_function(YY(i_cols),exo_simul, params, ...
steady_state,it);
if it == 2
if it == maximum_lag+1
[rows,cols,vals] = find(jacobian(:,i_cols_1));
iJacobian{1} = [offset+rows, i_cols_J1(cols), vals];
elseif it == T + 1
elseif it == maximum_lag+T
[rows,cols,vals] = find(jacobian(:,i_cols_T));
iJacobian{T} = [offset+rows, i_cols_J(i_cols_T(cols)), vals];
else
[rows,cols,vals] = find(jacobian(:,i_cols_j));
iJacobian{it-1} = [offset+rows, i_cols_J(cols), vals];
iJacobian{it-maximum_lag} = [offset+rows, i_cols_J(cols), vals];
i_cols_J = i_cols_J + ny;
end
offset = offset + ny;

View File

@ -67,9 +67,9 @@ elseif (options.solve_algo == 11)
end
end
y0 = endogenousvariables(:,1);
yT = endogenousvariables(:,periods+2);
z = endogenousvariables(:,2:periods+1);
y0 = endogenousvariables(:,M.maximum_lag);
yT = endogenousvariables(:,M.maximum_lag+periods+1);
z = endogenousvariables(:,M.maximum_lag+(1:periods));
illi = M.lead_lag_incidence';
[i_cols, junk,i_cols_j] = find(illi(:));
illi = illi(:,2:3);

View File

@ -69,7 +69,7 @@ else
check = 1;
end
endogenousvariables = [y0 reshape(y, M.endo_nbr, options.periods) yT];
endogenousvariables(:, M.maximum_lag+(1:options.periods)) = reshape(y, M.endo_nbr, options.periods);
if check
info.status = false;

View File

@ -1,20 +0,0 @@
function v = supported_octave_version()
% Copyright (C) 2017 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/>.
v = '4.2.1';

View File

@ -20,4 +20,11 @@ function [hasPackage] = user_has_octave_forge_package(package)
[desc,flag] = pkg('describe', package);
hasPackage = isequal(flag{1,1}, 'Loaded');
if isequal(flag{1,1}, 'Not installed')
hasPackage = 0;
else
if isequal(flag{1,1}, 'Not loaded')
pkg('load', package);
end
hasPackage = 1;
end

View File

@ -34,6 +34,7 @@ if test "x$ax_enable_matlab" = "xyes"; then
if test "x$ax_matlab_version_ok" = "xyes"; then
AX_MEXOPTS
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.5], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.5 (R2007b) at least.])])
fi
CFLAGS="$MATLAB_CFLAGS"

@ -1 +1 @@
Subproject commit a30f8f365e89b9520fa44caa6c3c1c288c0adbba
Subproject commit 84c2dc5f3621d47407397d519b623eb9d1fc1eb3

View File

@ -17,7 +17,7 @@ sigma2 = 0;
model;
// Eq. n°1:
efficiency = rho*efficiency(-1) + EfficiencyInnovation;
efficiency = rho*efficiency(-1) + EfficiencyInnovation(-2); // Use a lag of two to test the maximum_lag logic
// Eq. n°2:
Efficiency = effstar*exp(efficiency);

View File

@ -17,7 +17,7 @@ sigma2 = 0;
model;
// Eq. n°1:
efficiency = rho*efficiency(-1) + EfficiencyInnovation;
efficiency = rho*efficiency(-1) + EfficiencyInnovation(-2); // Use a lag of two to test the maximum_lag logic
// Eq. n°2:
Efficiency = effstar*exp(efficiency);