Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • 4.6
  • 5.x
  • 6.x
  • asm
  • aux_func
  • benchmark-ec
  • clang+openmp
  • covariance-quadratic-approximation
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dprior
  • dragonfly
  • dynamic-striated
  • dynare_minreal
  • eigen
  • ep-sparse
  • error_msg_undeclared_model_vars
  • estim_params
  • exceptions
  • exo_steady_state
  • filter_initial_state
  • gpm-optimal-policy
  • julia
  • kalman_mex
  • master
  • mex-GetPowerDeriv
  • mr#2134
  • new-samplers
  • newton-quadratic-equation-solver
  • nlf-fixes
  • nlf-fixes-r
  • nls-fixes
  • nonlinear-filter-fixes
  • occbin
  • pac-mce-with-composite-target
  • parfor
  • penalty
  • rebase-1
  • remove-persistent-variables
  • remove-priordens
  • reset-seed-in-unit-tests
  • rmExtraExo
  • sep
  • sep-fixes
  • separateM_
  • silicon
  • silicon-new-samplers
  • slice
  • sphinx-doc-experimental
  • static_aux_vars
  • time-varying-information-set
  • use-dprior
  • various_fixes
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
111 results

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • ebenetce/dynare
  • chskcau/dynare-doc-fixes
28 results
Select Git revision
  • 4.3
  • 4.4
  • 4.5
  • 4.6
  • 5.x
  • 6.x
  • asm
  • aux_func
  • clang+openmp
  • dates-and-dseries-improvements
  • declare_vars_in_model_block
  • dmm
  • dragonfly
  • dynare_minreal
  • eigen
  • error_msg_undeclared_model_vars
  • estim_params
  • exo_steady_state
  • gpm-optimal-policy
  • julia
  • madysson
  • master
  • mex-GetPowerDeriv
  • penalty
  • separateM_
  • slice
  • sphinx-doc-experimental
  • static_aux_vars
  • time-varying-information-set
  • various_fixes
  • 3.062
  • 3.063
  • 4.0.0
  • 4.0.1
  • 4.0.2
  • 4.0.3
  • 4.0.4
  • 4.1-alpha1
  • 4.1-alpha2
  • 4.1.0
  • 4.1.1
  • 4.1.2
  • 4.1.3
  • 4.2.0
  • 4.2.1
  • 4.2.2
  • 4.2.3
  • 4.2.4
  • 4.2.5
  • 4.3.0
  • 4.3.1
  • 4.3.2
  • 4.3.3
  • 4.4-beta1
  • 4.4.0
  • 4.4.1
  • 4.4.2
  • 4.4.3
  • 4.5.0
  • 4.5.1
  • 4.5.2
  • 4.5.3
  • 4.5.4
  • 4.5.5
  • 4.5.6
  • 4.5.7
  • 4.6-beta1
  • 4.6.0
  • 4.6.0-rc1
  • 4.6.0-rc2
  • 4.6.1
  • 4.6.2
  • 4.6.3
  • 4.6.4
  • 4.7-beta1
  • 4.7-beta2
  • 4.7-beta3
  • 5.0
  • 5.0-rc1
  • 5.1
  • 5.2
  • 5.3
  • 5.4
  • 5.5
  • 6-beta1
  • 6-beta2
  • 6.0
  • 6.1
  • 6.2
  • 6.3
  • 6.4
91 results
Show changes
Showing
with 303 additions and 150 deletions
......@@ -49,7 +49,7 @@ exo_ss = [oo.exo_steady_state; oo.exo_det_steady_state];
if length(M.aux_vars) > 0
h_set_auxiliary_variables = str2func([M.fname '_set_auxiliary_variables']);
if ~steadystate_flag
ys_init = h_set_auxiliary_variables(ys_init,exo_ss,M.params);
ys_init = h_set_auxiliary_variables(ys_init,exo_ss,params);
end
end
......@@ -258,7 +258,7 @@ elseif (options.bytecode == 0 && options.block == 0)
disp(['STEADY: numerical initial values or parameters incompatible with the following' ...
' equations'])
disp(ii')
disp('Check whether your model is truly linear. Put "resid(1);" before "steady;" to see the problematic equations.\n')
disp('Check whether your model is truly linear. Put "resid(1);" before "steady;" to see the problematic equations.')
elseif isempty(ii) && max(abs(fvec)) > 1e-12
ys = ys_init-jacob\fvec;
resid = evaluate_static_model(ys,exo_ss,params,M,options);
......@@ -290,7 +290,7 @@ if check
info(1)= 20;
%make sure ys contains auxiliary variables in case of problem with dynare_solve
if length(M.aux_vars) > 0 && ~steadystate_flag
ys = h_set_auxiliary_variables(ys,exo_ss,M.params);
ys = h_set_auxiliary_variables(ys,exo_ss,params);
end
resid = evaluate_static_model(ys,exo_ss,params,M,options);
info(2) = resid'*resid ;
......@@ -307,15 +307,15 @@ if M.static_and_dynamic_models_differ
z = repmat(ys,1,M.maximum_lead + M.maximum_lag + 1);
zx = repmat([exo_ss'], M.maximum_lead + M.maximum_lag + 1, 1);
if options.bytecode
[chck, r, junk]= bytecode('dynamic','evaluate', z, zx, M.params, ys, 1);
[chck, r, junk]= bytecode('dynamic','evaluate', z, zx, params, ys, 1);
mexErrCheck('bytecode', chck);
elseif options.block
[r, oo.dr] = feval([M.fname '_dynamic'], z', zx, M.params, ys, M.maximum_lag+1, oo.dr);
[r, oo.dr] = feval([M.fname '_dynamic'], z', zx, params, ys, M.maximum_lag+1, oo.dr);
else
iyv = M.lead_lag_incidence';
iyr0 = find(iyv(:));
xys = z(iyr0);
r = feval([M.fname '_dynamic'], z(iyr0), zx, M.params, ys, M.maximum_lag + 1);
r = feval([M.fname '_dynamic'], z(iyr0), zx, params, ys, M.maximum_lag + 1);
end
% Fail if residual greater than tolerance
if max(abs(r)) > options.solve_tolf
......
......@@ -70,7 +70,14 @@ else
updated_params_flag = 0;
end
if M.set_auxiliary_variables
% Define function handle for the function setting the auxiliary
% variables only if the model has auxiliary variables. Otherwise
% Octave may crash (see https://savannah.gnu.org/bugs/?52568) because
% the function does not exist in the path.
h_set_auxiliary_variables = str2func([M.fname '_set_auxiliary_variables']);
end
if isnan(updated_params_flag) || (updated_params_flag && any(isnan(params(~isnan(params))-params1(~isnan(params))))) %checks if new NaNs were added
info(1) = 24;
info(2) = NaN;
......@@ -105,7 +112,7 @@ if length(M.aux_vars) > 0 && ~options.ramsey_policy
if debug
ys = h_set_auxiliary_variables(ys,exo_ss,params);
ys3 = ys;
idx = find(abs(ys0-ys1)>0);
idx = find(abs(ys0-ys1(1:M.orig_endo_nbr))>0);
if ~isempty(idx)
M.endo_names(idx,:)
else
......@@ -117,7 +124,7 @@ if length(M.aux_vars) > 0 && ~options.ramsey_policy
else
disp('2-invariant')
end
idx = find(abs(ys3-ys3)>0);
idx = find(abs(ys3-ys2)>0);
if ~isempty(idx)
M.endo_names(idx,:)
else
......
......@@ -62,17 +62,24 @@ if strcmpi(type,'posterior')
n_draws=options_.sub_draws;
prior = false;
elseif strcmpi(type,'prior')
if isempty(bayestopt_)
if ~isempty(estim_params_) && ~(isfield(estim_params_,'nvx') && (size(estim_params_.var_exo,1)+size(estim_params_.var_endo,1)+size(estim_params_.corrx,1)+size(estim_params_.corrn,1)+size(estim_params_.param_vals,1))==0)
[xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);
else
error('The prior distributions are not properly set up.')
end
end
prior_draw(bayestopt_, options_.prior_trunc);
else
error('EXECUTE_POSTERIOR_FUNCTION: Unknown type!')
end
%get draws for later use
first_draw=GetOneDraw(type);
first_draw=GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_);
parameter_mat=NaN(n_draws,length(first_draw));
parameter_mat(1,:)=first_draw;
for draw_iter=2:n_draws
parameter_mat(draw_iter,:) = GetOneDraw(type);
parameter_mat(draw_iter,:) = GetOneDraw(type,M_,estim_params_,oo_,options_,bayestopt_);
end
% get output size
......
......@@ -10,7 +10,7 @@ function expand_group(use_shock_groups,var_list_, ic)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2016-2017 Dynare Team
% Copyright (C) 2016-2018 Dynare Team
%
% This file is part of Dynare.
%
......@@ -27,23 +27,56 @@ function expand_group(use_shock_groups,var_list_, ic)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
filename = get(gcf,'filename');
[filepath, name, ext]=fileparts(filename);
M = evalin('base','M_');
oo = evalin('base','oo_');
options = evalin('base','options_');
mydata=get(findobj(gcf,'tag',['group' int2str(ic)]),'userdata');
if isfield(mydata,'shock_decomp')
if isfield(mydata,'plot_shock_decomp')
options.plot_shock_decomp=mydata.plot_shock_decomp;
options.shock_decomp=mydata.shock_decomp;
else
options.plot_shock_decomp=mydata.shock_decomp;
end
else
options.plot_shock_decomp=mydata.plot_shock_decomp;
end
if isfield(mydata,'first_obs')
options.first_obs=mydata.first_obs;
end
if isfield(mydata,'nobs')
options.nobs=mydata.nobs;
end
% define expanded group
label = mydata.shock_group.label;
label = strrep(label,' ','_');
label = strrep(label,'-','_');
shocks = mydata.shock_group.shocks;
options.shock_decomp.fig_name = [mydata.fig_name '. Expand'];
options.use_shock_groups = strrep(label,' ','_'); %[use_shock_groups_old int2str(ic)];
options.plot_shock_decomp.fig_name = [mydata.fig_name '. Expand'];
options.plot_shock_decomp.use_shock_groups = label; %[use_shock_groups_old int2str(ic)];
options.plot_shock_decomp.filepath = filepath;
for j=1:length(shocks)
M.shock_groups.(options.use_shock_groups).(['group' int2str(j)]).label=shocks{j};
M.shock_groups.(options.use_shock_groups).(['group' int2str(j)]).shocks=shocks(j);
M.shock_groups.(options.plot_shock_decomp.use_shock_groups).(['group' int2str(j)]).label=shocks{j};
M.shock_groups.(options.plot_shock_decomp.use_shock_groups).(['group' int2str(j)]).shocks=shocks(j);
end
options.plot_shock_decomp.interactive=0;
options.plot_shock_decomp.expand=1;
options.plot_shock_decomp.nodisplay=0;
options.plot_shock_decomp.write_xls=0;
%% set optimal colormap
func = @(x) colorspace('RGB->Lab',x);
MAP = distinguishable_colors(length(shocks)+1,'w',func);
MAP(end,:) = [0.7 0.7 0.7];
options.plot_shock_decomp.colormap = MAP;
if isfield(mydata,'endo_names')
options.plot_shock_decomp.endo_names = mydata.endo_names;
options.plot_shock_decomp.endo_names_tex = mydata.endo_names_tex;
end
options.shock_decomp.interactive=0;
options.shock_decomp.expand=1;
plot_shock_decomposition(M,oo,options,var_list_);
......@@ -50,6 +50,11 @@ for ii=1:size(estim_params_.var_exo,1)
trace_plot(options_,M_,estim_params_,'StructuralShock',chain_number,parameter_name)
end
for ii=1:size(estim_params_.var_endo,1)
parameter_name=deblank(M_.endo_names(estim_params_.var_endo(ii,1),:));
trace_plot(options_,M_,estim_params_,'MeasurementError',chain_number,parameter_name)
end
for ii=1:size(estim_params_.corrn,1)
parameter_name_1=deblank(M_.endo_names(estim_params_.corrn(ii,1),:));
parameter_name_2=deblank(M_.endo_names(estim_params_.corrn(ii,2),:));
......
function xparam = get_posterior_parameters(type,field1)
function xparam = get_posterior_parameters(type,M_,estim_params_,oo_,options_,field1)
% function xparam = get_posterior_parameters(type)
% function xparam = get_posterior_parameters(type,M_,estim_params_,oo_,options_,field1)
% Selects (estimated) parameters (posterior mode or posterior mean).
%
% INPUTS
% o type [char] = 'mode' or 'mean'.
% o M_: [structure] Dynare structure describing the model.
% o estim_params_: [structure] Dynare structure describing the estimated parameters.
% o field_1 [char] optional field like 'mle_'.
%
% OUTPUTS
......@@ -30,9 +32,7 @@ function xparam = get_posterior_parameters(type,field1)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global estim_params_ oo_ options_ M_
if nargin<2
if nargin<6
field1='posterior_';
end
nvx = estim_params_.nvx;
......@@ -48,7 +48,6 @@ for i=1:nvx
k1 = estim_params_.var_exo(i,1);
name1 = deblank(M_.exo_names(k1,:));
xparam(m) = oo_.([field1 type]).shocks_std.(name1);
M_.Sigma_e(k1,k1) = xparam(m)^2;
m = m+1;
end
......@@ -65,8 +64,6 @@ for i=1:ncx
name1 = deblank(M_.exo_names(k1,:));
name2 = deblank(M_.exo_names(k2,:));
xparam(m) = oo_.([field1 type]).shocks_corr.([name1 '_' name2]);
M_.Sigma_e(k1,k2) = xparam(m);
M_.Sigma_e(k2,k1) = xparam(m);
m = m+1;
end
......@@ -84,10 +81,5 @@ FirstDeep = m;
for i=1:np
name1 = deblank(M_.param_names(estim_params_.param_vals(i,1),:));
xparam(m) = oo_.([field1 type]).parameters.(name1);
%assignin('base',name1,xparam(m));% Useless with version 4 (except maybe for users)
m = m+1;
end
\ No newline at end of file
if np
M_.params(estim_params_.param_vals(:,1)) = xparam(FirstDeep:end);
end
\ No newline at end of file
......@@ -11,7 +11,7 @@ function global_initialization()
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2017 Dynare Team
% Copyright (C) 2003-2019 Dynare Team
%
% This file is part of Dynare.
%
......@@ -213,6 +213,7 @@ ep.replic_nbr = 1;
% Parallel execution of replications
ep.parallel = false;
% Stochastic extended path related options.
ep.stochastic.IntegrationAlgorithm = 'Tensor-Gaussian-Quadrature'; % Other possible values are 'Stroud-Cubature-3' and 'Stroud-Cubature-5'
ep.stochastic.method = '';
ep.stochastic.algo = 0;
ep.stochastic.quadrature.ortpol = 'hermite';
......@@ -520,7 +521,6 @@ options_.filter_decomposition = 0;
options_.selected_variables_only = 0;
options_.contemporaneous_correlation = 0;
options_.initialize_estimated_parameters_with_the_prior_mode = 0;
options_.estimation_dll = 0;
options_.estimation.moments_posterior_density.indicator = 1;
options_.estimation.moments_posterior_density.gridpoints = 2^9;
options_.estimation.moments_posterior_density.bandwidth = 0; % Rule of thumb optimal bandwidth parameter.
......@@ -725,7 +725,7 @@ options_.discretionary_tol = 1e-7;
% Shock decomposition
options_.parameter_set = [];
options_.use_shock_groups = '';
options_.colormap = '';
options_.shock_decomp.colormap = '';
options_.shock_decomp.init_state = 0;
% Shock decomposition realtime
......
......@@ -11,7 +11,7 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
% DynareModel [structure] Dynare model structure
% DynareOptions [structure] Dynare options structure
% Copyright (C) 2010-2017 Dynare Team
% Copyright (C) 2010-2018 Dynare Team
%
% This file is part of Dynare.
%
......@@ -28,7 +28,9 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~DynareOptions.plot_shock_decomp.expand
GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
end
new_colormap = DynareOptions.plot_shock_decomp.colormap;
% number of components equals number of shocks + 1 (initial conditions)
......@@ -52,7 +54,7 @@ fig_name_long = opts_decomp.fig_name;
use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
screen_shocks = opts_decomp.screen_shocks;
if use_shock_groups | comp_nbr<=18
if ~isempty(use_shock_groups) || comp_nbr<=18
screen_shocks=0;
end
if use_shock_groups
......@@ -87,7 +89,7 @@ end
nvar = length(i_var);
%% write LaTeX-Header
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format))) && ~DynareOptions.plot_shock_decomp.expand
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp.m.\n');
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
......@@ -189,16 +191,22 @@ for j=1:nvar
hold on
ht = text(0.3,y1+0.3*height,labels(i,:),'Interpreter','none');
hold on
if interactive & (~isoctave & use_shock_groups)
if interactive && (~isoctave && ~isempty(use_shock_groups))
mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
mydata.shock_group = shock_groups.(shock_ind{i});
mydata.shock_decomp = DynareOptions.plot_shock_decomp;
if ~isempty(mydata.shock_group.shocks{1})
mydata.shock_decomp = DynareOptions.shock_decomp;
mydata.plot_shock_decomp = DynareOptions.plot_shock_decomp;
mydata.first_obs = DynareOptions.first_obs;
mydata.nobs = DynareOptions.nobs;
mydata.plot_shock_decomp.zfull = DynareOptions.plot_shock_decomp.zfull(i_var(j),:,:);
mydata.endo_names = deblank(endo_names(i_var(j),:));
mydata.endo_names_tex = deblank(DynareModel.endo_names_tex(i_var(j),:));
if ~isempty(mydata.shock_group.shocks)
c = uicontextmenu;
hl.UIContextMenu=c;
browse_menu = uimenu(c,'Label','Browse group');
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(mydata.shock_decomp.orig_varlist(j,:)) ''',' int2str(i) ')']);
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' deblank(mydata.plot_shock_decomp.orig_varlist(j,:)) ''',' int2str(i) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(i)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
......@@ -213,6 +221,8 @@ for j=1:nvar
colormap(new_colormap)
end
hold off
if ~DynareOptions.plot_shock_decomp.expand
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
......@@ -223,10 +233,14 @@ for j=1:nvar
fprintf(fidTeX,'\\end{figure}\n');
fprintf(fidTeX,' \n');
end
else
dyn_saveas(fhandle,[DynareOptions.plot_shock_decomp.filepath, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
end
end
%% write LaTeX-Footer
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format))) && ~DynareOptions.plot_shock_decomp.expand
fprintf(fidTeX,' \n');
fprintf(fidTeX,'%% End of TeX file.\n');
fclose(fidTeX);
......
......@@ -11,7 +11,7 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
% DynareModel [structure] Dynare model structure
% DynareOptions [structure] Dynare options structure
% Copyright (C) 2010-2017 Dynare Team
% Copyright (C) 2010-2018 Dynare Team
%
% This file is part of Dynare.
%
......@@ -28,7 +28,9 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~DynareOptions.plot_shock_decomp.expand
GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
end
% interactive = 0;
fig_mode='';
fig_mode1='';
......@@ -52,7 +54,7 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
screen_shocks = opts_decomp.screen_shocks;
if DynareOptions.plot_shock_decomp.use_shock_groups | comp_nbr<=18
if ~isempty(DynareOptions.plot_shock_decomp.use_shock_groups) || comp_nbr<=18
screen_shocks=0;
end
fig_name_long = opts_decomp.fig_name;
......@@ -98,6 +100,9 @@ end
if abs(floor(x(1))-xind_tick(1))-abs(ceil(x(end))-xind_tick(end))<-1
xind_tick = xind_tick+1;
end
if length(xind_tick)==gend,
xind_tick = x(2:end);
end
% xind_tick = [x(ind_yrs(1))-floor(dind_tick/2):dind_tick:x(ind_yrs(end))+floor(dind_tick/2)]+1;
% xind_tick = x(ind_yrs(1))-1:dind_tick:x(ind_yrs(end))+1;
% xind_tick = x(ind_yrs(1))-1:dind_tick:x(ind_yrs(end))+dind_tick;
......@@ -105,7 +110,7 @@ end
nvar = length(i_var);
%% write LaTeX-Header
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format))) && ~DynareOptions.plot_shock_decomp.expand
fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '_detail.tex'],'w');
fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp_detail.m.\n');
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
......@@ -162,12 +167,22 @@ for j=1:nvar
ipos=zz>0;
ineg=zz<0;
hax = subplot(nrow,ncol,i); set(gca,'box','on')
hbar = bar(x(2:end),(zz.*ipos)','stacked');
colormap([0.15 0.15 0.15;0.85 0.85 0.85]),
hbar = bar(x(2:end),(zz.*ipos)','stacked','FaceColor','flat');
if ~isoctave && ~matlab_ver_less_than('9.3.0')
% make bar obey colormap under MATLAB R2017b
for k = 1:2
hbar(k).CData = k;
end
end
set(hbar,'edgecolor','flat');
hold on,
hbar = bar(x(2:end),(zz.*ineg)','stacked');
colormap([0.15 0.15 0.15;0.85 0.85 0.85]),
hbar = bar(x(2:end),(zz.*ineg)','stacked','FaceColor','flat');
if ~isoctave && ~matlab_ver_less_than('9.3.0')
% make bar obey colormap under MATLAB R2017b
for k = 1:2
hbar(k).CData = k;
end
end
set(hbar,'edgecolor','flat');
title(deblank(labels(ic,:)),'Interpreter','none'),
axis tight;
......@@ -178,16 +193,22 @@ for j=1:nvar
a0(4)=max(a(4),a0(4));
set(gca,'ylim',a0(3:4))
hold on, h1=plot(x(2:end),z1(end,:),'k-','LineWidth',2);
if interactive & (~isoctave & use_shock_groups)
if interactive && (~isoctave && ~isempty(use_shock_groups))
mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
mydata.shock_group = shock_groups.(shock_ind{ic});
mydata.shock_decomp = DynareOptions.plot_shock_decomp;
if ~isempty(mydata.shock_group.shocks{1})
mydata.shock_decomp = DynareOptions.shock_decomp;
mydata.plot_shock_decomp = DynareOptions.plot_shock_decomp;
mydata.first_obs = DynareOptions.first_obs;
mydata.nobs = DynareOptions.nobs;
mydata.plot_shock_decomp.zfull = DynareOptions.plot_shock_decomp.zfull(i_var(j),:,:);
mydata.endo_names = deblank(endo_names(i_var(j),:));
mydata.endo_names_tex = deblank(DynareModel.endo_names_tex(i_var(j),:));
if ~isempty(mydata.shock_group.shocks)
c = uicontextmenu;
hax.UIContextMenu=c;
browse_menu = uimenu(c,'Label','Browse group');
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.use_shock_groups ''',''' deblank(mydata.shock_decomp.orig_varlist(j,:)) ''',' int2str(ic) ')']);
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' deblank(mydata.plot_shock_decomp.orig_varlist(j,:)) ''',' int2str(ic) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(ic)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
......@@ -217,6 +238,7 @@ for j=1:nvar
hold on
x1 = x1 + width;
end
colormap([0.15 0.15 0.15;0.85 0.85 0.85]),
if nfigs>1
......@@ -224,6 +246,7 @@ for j=1:nvar
else
suffix = ['_detail'];
end
if ~DynareOptions.plot_shock_decomp.expand
dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
fprintf(fidTeX,'\\begin{figure}[H]\n');
......@@ -234,11 +257,15 @@ for j=1:nvar
fprintf(fidTeX,'\\end{figure}\n');
fprintf(fidTeX,' \n');
end
else
dyn_saveas(fhandle,[DynareOptions.plot_shock_decomp.filepath, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
end
end
end
%% write LaTeX-Footer
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format))) && ~DynareOptions.plot_shock_decomp.expand
fprintf(fidTeX,' \n');
fprintf(fidTeX,'%% End of TeX file.\n');
fclose(fidTeX);
......
......@@ -42,7 +42,6 @@ end
pvalue_ks = DynareOptions.opt_gsa.pvalue_ks;
indx_irf = [];
indx_moment = [];
DynareOptions.nodisplay = 1;
init = ~DynareOptions.opt_gsa.load_stab;
options_mcf.pvalue_ks = DynareOptions.opt_gsa.pvalue_ks;
......@@ -395,6 +394,7 @@ if ~isempty(indx_moment)
% For single legend search which has maximum nbr of restrictions
maxijv=0;
for ij=1:nbr_moment_restrictions
endo_prior_restrictions.moment{ij,3} = sort(endo_prior_restrictions.moment{ij,3});
if length(endo_prior_restrictions.moment{ij,3})>maxijv
maxij=ij;maxijv=length(endo_prior_restrictions.moment{ij,3});
end
......@@ -478,6 +478,7 @@ if ~isempty(indx_moment)
% end
end
for ij=1:nbr_moment_couples
time_matrix{ij} = sort(time_matrix{ij});
if length(time_matrix{ij})>1
if ~DynareOptions.nograph
itmp = (find(plot_indx==ij));
......@@ -506,7 +507,7 @@ if ~isempty(indx_moment)
hold off
axis(a)
box on
set(gca,'xtick',sort(time_matrix{ij}))
% set(gca,'xtick',sort(time_matrix{ij}))
itmp = min(itmp);
title([endo_prior_restrictions.moment{itmp,1},' vs ',endo_prior_restrictions.moment{itmp,2}],'interpreter','none'),
end
......
......@@ -34,6 +34,8 @@ if DynareOptions.TeX
else
param_names_tex = options_mcf.param_names_tex;
end
else
param_names_tex = char(strrep(cellstr(options_mcf.param_names),'_','\_'));
end
amcf_name = options_mcf.amcf_name;
amcf_title = options_mcf.amcf_title;
......@@ -78,7 +80,7 @@ if ~isempty(indmcf) && ~DynareOptions.nograph
skipline()
xx=[];
if ~ isempty(xparam1), xx=xparam1(indmcf); end
scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names(indmcf,:), ...
scatter_mcf(lpmat(ibeha,indmcf),lpmat(inobeha,indmcf), param_names_tex(indmcf,:), ...
'.', [fname_,'_',amcf_name], OutputDirectoryName, amcf_title,xx, DynareOptions, ...
beha_title, nobeha_title)
end
......@@ -232,10 +232,27 @@ for j=1:size(anamendo,1)
istable=[1:length(iy)];
save([xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namexo '_threshold' ],'lpmat','lpmat0','istable','y0','x0','xx0','iy','iyc')
lpmat=[]; lpmat0=[]; istable=[];
if length(iy)<=10 || length(iyc)<=10
icheck = []; % do the generic plot in any case
end
else
icheck=[];
end
if isempty(icheck)
if length(iy)<=10
if isempty(iy)
disp(['There are NO MC samples in the desired range [' num2str(threshold) ']!'])
else
disp(['There are TOO FEW (<=10) MC samples in the desired range [' num2str(threshold) ']!'])
end
elseif length(iyc)<=10
if isempty(iyc)
disp(['ALL MC samples are in the desired range [' num2str(threshold) ']!'])
else
disp(['Almost ALL MC samples are in the desired range [' num2str(threshold) ']!'])
disp('There are TOO FEW (<=10) MC samples OUTSIDE the desired range!')
end
end
atitle0=['Monte Carlo Filtering for ',namendo,' vs ', namexo];
options_mcf.title = atitle0;
indmcf = redform_mcf(y0, x0, options_mcf, options_);
......@@ -280,6 +297,8 @@ for j=1:size(anamendo,1)
end
end
else
disp(['This entry in the shock matrix is CONSTANT = ' num2str(mean(y0),3)])
end
end
end
......@@ -369,11 +388,28 @@ for j=1:size(anamendo,1)
istable=[1:length(iy)];
save([xdir,filesep, fname_ '_' type '_' namendo,'_vs_', namlagendo '_threshold' ],'lpmat','lpmat0','istable','y0','x0','xx0','iy','iyc')
lpmat=[]; lpmat0=[]; istable=[];
if length(iy)<=10 || length(iyc)<=10,
icheck = []; % do the generic plot in any case
end
else
icheck = [];
end
if isempty(icheck)
if length(iy)<=10
if isempty(iy)
disp(['There are NO MC samples in the desired range [' num2str(threshold) ']!'])
else
disp(['There are TOO FEW (<=10) MC samples in the desired range [' num2str(threshold) ']!'])
end
elseif length(iyc)<=10
if isempty(iyc)
disp(['ALL MC samples are in the desired range [' num2str(threshold) ']!'])
else
disp(['Almost ALL MC samples are in the desired range [' num2str(threshold) ']!'])
disp('There are TOO FEW (<=10) MC samples OUTSIDE the desired range!')
end
end
atitle0=['Monte Carlo Filtering for ',namendo,' vs ', namlagendo];
options_mcf.title = atitle0;
indmcf = redform_mcf(y0, x0, options_mcf, options_);
......@@ -417,6 +453,8 @@ for j=1:size(anamendo,1)
end
end
else
disp(['This entry in the transition matrix is CONSTANT = ' num2str(mean(y0),3)])
end
end
end
......@@ -736,6 +774,11 @@ for jt=1:10
end
[proba, dproba] = stab_map_1(x0, indy{1}, indy{end}, [],0);
indmcf=find(proba<options_mcf.pvalue_ks);
if isempty(indmcf)
[tmp,jtmp] = sort(proba,2,'ascend');
indmcf = jtmp(1);
% indmcf = jtmp(1:min(2,length(proba)));
end
[tmp,jtmp] = sort(proba(indmcf),2,'ascend');
indmcf = indmcf(jtmp);
nbr_par = length(indmcf);
......
......@@ -143,7 +143,7 @@ for i = 1:p
end
if i==1
if nflag == 1
ylabel(vnames(j,:),'Rotation',45,'interpreter','none', ...
ylabel(vnames(j,:),'Rotation',45, ...
'HorizontalAlignment','right','VerticalAlignment','middle');
else
ylabel([num2str(j),' '],'Rotation',90)
......@@ -151,7 +151,7 @@ for i = 1:p
end
if j==1
if nflag == 1
title(vnames(i,:),'interpreter','none','Rotation',45, ...
title(vnames(i,:),'Rotation',45, ...
'HorizontalAlignment','left','VerticalAlignment','bottom')
else
title(num2str(i))
......
......@@ -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
......@@ -122,24 +123,27 @@ if info(1)==0
ide_strength_J=NaN(1,nparam);
ide_strength_J_prior=NaN(1,nparam);
if init
normaliz = NaN(1,nparam);
ide_uncert_unnormaliz = NaN(1,nparam);
if prior_exist
offset_prior=0;
if ~isempty(estim_params_.var_exo)
normaliz1 = estim_params_.var_exo(:,7)'; % normalize with prior standard deviation
normaliz_prior_std = bayestopt_.p2(1:estim_params_.nvx)'; % normalize with prior standard deviation
offset_prior=offset_prior+estim_params_.nvx+estim_params_.nvn;
else
normaliz1=[];
normaliz_prior_std=[];
end
if ~isempty(estim_params_.corrx)
normaliz1 = [normaliz1 estim_params_.corrx(:,8)']; % normalize with prior standard deviation
normaliz_prior_std = [normaliz_prior_std bayestopt_.p2(offset_prior+1:offset_prior+estim_params_.ncx)']; % normalize with prior standard deviation
offset_prior=offset_prior+estim_params_.ncx+estim_params_.ncn;
end
if ~isempty(estim_params_.param_vals)
normaliz1 = [normaliz1 estim_params_.param_vals(:,7)']; % normalize with prior standard deviation
normaliz_prior_std = [normaliz_prior_std bayestopt_.p2(offset_prior+1:offset_prior+estim_params_.np)']; % normalize with prior standard deviation
end
% normaliz = max([normaliz; normaliz1]);
normaliz1(isinf(normaliz1)) = 1;
% normaliz1(isinf(normaliz1)) = 1;
else
normaliz1 = NaN(1,nparam);
normaliz_prior_std = NaN(1,nparam);
end
try
options_.irf = 0;
......@@ -155,7 +159,7 @@ if info(1)==0
info = stoch_simul(char(options_.varobs));
dataset_ = dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'), options_.varobs);
derivatives_info.no_DLIK=1;
%bounds = prior_bounds(bayestopt_, options_.prior_trunc);
bounds = prior_bounds(bayestopt_, options_.prior_trunc); %reset bounds as lb and ub must only be operational during mode-finding
[fval,info,cost_flag,DLIK,AHess,ys,trend_coeff,M_,options_,bayestopt_,oo_] = dsge_likelihood(params',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_,derivatives_info);
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
options_.analytic_derivation = analytic_derivation;
......@@ -175,7 +179,7 @@ if info(1)==0
end
indok = find(max(ide_hess.indno,[],1)==0);
cparam(indok,indok) = inv(AHess(indok,indok));
normaliz(indok) = sqrt(diag(cparam(indok,indok)))';
ide_uncert_unnormaliz(indok) = sqrt(diag(cparam(indok,indok)))';
cmm = NaN(size(siJ,1),size(siJ,1));
ind1=find(ide_hess.ind0);
cmm = siJ(:,ind1)*((AHess(ind1,ind1))\siJ(:,ind1)');
......@@ -241,22 +245,23 @@ if info(1)==0
clre = siLRE(:,ind1-offset)*((MIM(ind1,ind1))\siLRE(:,ind1-offset)');
if ~isempty(indok)
rhoM(indok)=sqrt(1./diag(inv(tildaM(indok,indok))));
normaliz(indok) = (sqrt(diag(inv(tildaM(indok,indok))))./deltaM(indok))'; %sqrt(diag(inv(MIM(indok,indok))))';
ide_uncert_unnormaliz(indok) = (sqrt(diag(inv(tildaM(indok,indok))))./deltaM(indok))'; %sqrt(diag(inv(MIM(indok,indok))))';
end
% deltaM = deltaM.*abs(params')
flag_score=0;
end
ide_strength_J(indok) = (1./(normaliz(indok)'./abs(params(indok)')));
ide_strength_J_prior(indok) = (1./(normaliz(indok)'./normaliz1(indok)'));
ide_strength_J(params==0)=1./normaliz(params==0)';
deltaM_prior = deltaM.*abs(normaliz1');
ide_strength_J(indok) = (1./(ide_uncert_unnormaliz(indok)'./abs(params(indok)')));
ide_strength_J_prior(indok) = (1./(ide_uncert_unnormaliz(indok)'./normaliz_prior_std(indok)'));
%ide_strength_J(params==0)=1./ide_uncert_unnormaliz(params==0)';
sensitivity_zero_pos=find(isinf(deltaM));
deltaM_prior = deltaM.*abs(normaliz_prior_std');
deltaM = deltaM.*abs(params');
deltaM(params==0)=deltaM_prior(params==0);
%deltaM(params==0)=deltaM_prior(params==0);
quant = siJ./repmat(sqrt(diag(cmm)),1,nparam);
if size(quant,1)==1
siJnorm = abs(quant).*normaliz1;
siJnorm = abs(quant).*normaliz_prior_std;
else
siJnorm = vnorm(quant).*normaliz1;
siJnorm = vnorm(quant).*normaliz_prior_std;
end
% siJnorm = vnorm(siJ(inok,:)).*normaliz;
quant=[];
......@@ -271,9 +276,9 @@ if info(1)==0
if ~isempty(iy)
quant = siH./repmat(sqrt(diag_chh(iy)),1,nparam);
if size(quant,1)==1
siHnorm = abs(quant).*normaliz1;
siHnorm = abs(quant).*normaliz_prior_std;
else
siHnorm = vnorm(quant).*normaliz1;
siHnorm = vnorm(quant).*normaliz_prior_std;
end
else
siHnorm = [];
......@@ -291,9 +296,9 @@ if info(1)==0
if ~isempty(iy)
quant = siLRE./repmat(sqrt(diag_clre(iy)),1,np);
if size(quant,1)==1
siLREnorm = abs(quant).*normaliz1(offset+1:end);
siLREnorm = abs(quant).*normaliz_prior_std(offset+1:end);
else
siLREnorm = vnorm(quant).*normaliz1(offset+1:end);
siLREnorm = vnorm(quant).*normaliz_prior_std(offset+1:end);
end
else
siLREnorm=[];
......@@ -303,6 +308,8 @@ if info(1)==0
ide_hess.ide_strength_J_prior=ide_strength_J_prior;
ide_hess.deltaM=deltaM;
ide_hess.deltaM_prior=deltaM_prior;
ide_hess.sensitivity_zero_pos=sensitivity_zero_pos;
ide_hess.identified_parameter_indices=indok;
ide_moments.siJnorm=siJnorm;
ide_model.siHnorm=siHnorm;
ide_lre.siLREnorm=siLREnorm;
......
function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
% Computes conditional forecasts.
%
% INPUTS
% o constrained_paths [double] m*p array, where m is the number of constrained endogenous variables and p is the number of constrained periods.
% o constrained_vars [char] m*x array holding the names of the controlled endogenous variables.
% o options_cond_fcst [structure] containing the options. The fields are:
% - consnstrained_paths [double] m*p array, where m is the number of constrained endogenous variables and p is the number of constrained periods.
% - constrained_vars [integer] m*1 array, indices in M_.endo_names of the constrained variables.
% - options_cond_fcst [structure] containing the options. The fields are:
%
% + replic [integer] scalar, number of monte carlo simulations.
% + parameter_set [char] values of the estimated parameters:
% "posterior_mode",
% "posterior_mean",
% "posterior_median",
% "prior_mode" or
% "prior mean".
% 'posterior_mode',
% 'posterior_mean',
% 'posterior_median',
% 'prior_mode' or
% 'prior mean'.
% [double] np*1 array, values of the estimated parameters.
% + controlled_varexo [char] m*x array, list of controlled exogenous variables.
% + controlled_varexo [char] m*n char array, list of controlled exogenous variables (n is the length of the longest name).
% + conf_sig [double] scalar in [0,1], probability mass covered by the confidence bands.
%
% OUTPUTS
% None.
%
% (n is the length of the longest name)
% SPECIAL REQUIREMENTS
% This routine has to be called after an estimation statement or an estimated_params block.
%
......@@ -80,16 +82,16 @@ if estimated_model
if ischar(options_cond_fcst.parameter_set)
switch options_cond_fcst.parameter_set
case 'posterior_mode'
xparam = get_posterior_parameters('mode');
xparam = get_posterior_parameters('mode',M_,estim_params_,oo_,options_);
graph_title='Posterior Mode';
case 'posterior_mean'
xparam = get_posterior_parameters('mean');
xparam = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
graph_title='Posterior Mean';
case 'posterior_median'
xparam = get_posterior_parameters('median');
xparam = get_posterior_parameters('median',M_,estim_params_,oo_,options_);
graph_title='Posterior Median';
case 'mle_mode'
xparam = get_posterior_parameters('mode','mle_');
xparam = get_posterior_parameters('mode',M_,estim_params_,oo_,options_,'mle_');
graph_title='ML Mode';
case 'prior_mode'
xparam = bayestopt_.p5(:);
......
......@@ -74,7 +74,7 @@ end
if ~isfield(oo_,'initval_decomposition')
options_.selected_variables_only = 0; %make sure all variables are stored
options_.plot_priors=0;
[oo,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
[oo,M,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
% reduced form
dr = oo.dr;
......@@ -125,8 +125,14 @@ oo=oo_;
oo.shock_decomposition = oo_.initval_decomposition;
M_.exo_names = M_.endo_names;
M_.exo_nbr = M_.endo_nbr;
options_.plot_shock_decomp.realtime=0;
options_.plot_shock_decomp.screen_shocks=1;
options_.plot_shock_decomp.use_shock_groups = '';
options_.plot_shock_decomp.fig_names='initval';
fig_name = options_.plot_shock_decomp.fig_name;
if ~isempty(fig_name)
options_.plot_shock_decomp.fig_name=[fig_name '_initval'];
else
options_.plot_shock_decomp.fig_name='initval';
end
plot_shock_decomposition(M_,oo,options_,varlist);
% end
\ No newline at end of file
......@@ -45,11 +45,13 @@ if DynareOptions.order>1 && any(any(isnan(DynareDataset.data)))
error('initial_estimation_checks:: particle filtering does not support missing observations')
end
if maximum_number_non_missing_observations>Model.exo_nbr+EstimatedParameters.nvn
non_zero_ME=length(EstimatedParameters.H_entries_to_check_for_positive_definiteness);
if maximum_number_non_missing_observations>Model.exo_nbr+non_zero_ME
error(['initial_estimation_checks:: Estimation can''t take place because there are less declared shocks than observed variables!'])
end
if maximum_number_non_missing_observations>length(find(diag(Model.Sigma_e)))+EstimatedParameters.nvn
if maximum_number_non_missing_observations>length(find(diag(Model.Sigma_e)))+non_zero_ME
error(['initial_estimation_checks:: Estimation can''t take place because too many shocks have been calibrated with a zero variance!'])
end
......@@ -106,7 +108,7 @@ end
test_for_deep_parameters_calibration(Model);
[lnprior, junk1,junk2,info]= priordens(xparam1,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4);
if info
if any(info)
fprintf('The prior density evaluated at the initial values is Inf for the following parameters: %s\n',BayesInfo.name{info,1})
error('The initial value of the prior is -Inf')
end
......
......@@ -44,11 +44,16 @@ else
end
y = 0;
if iorder == 1
local_order = iorder;
if M_.hessian_eq_zero && local_order~=1
local_order = 1;
end
if local_order == 1
y1 = repmat(dr.ys,1,long);
ex2 = zeros(long,M_.exo_nbr);
ex2(1,:) = e1';
y2 = simult_(temps,dr,ex2,iorder);
y2 = simult_(temps,dr,ex2,local_order);
y = y2(:,M_.maximum_lag+1:end)-y1;
else
% eliminate shocks with 0 variance
......@@ -61,8 +66,8 @@ else
ex1(:,i_exo_var) = randn(long+drop,nxs)*chol_S;
ex2 = ex1;
ex2(drop+1,:) = ex2(drop+1,:)+e1';
y1 = simult_(temps,dr,ex1,iorder);
y2 = simult_(temps,dr,ex2,iorder);
y1 = simult_(temps,dr,ex1,local_order);
y2 = simult_(temps,dr,ex2,local_order);
y = y+(y2(:,M_.maximum_lag+drop+1:end)-y1(:,M_.maximum_lag+drop+1:end));
end
y=y/replic;
......
......@@ -58,31 +58,31 @@ end
%@test:1
%$ t = false(3,1);
%$ mkdir toto
%$ mkdir toto;
%$ cd toto
%$ mkdir titi
%$ mkdir tata
%$ mkdir titi;
%$ mkdir tata;
%$ cd tata
%$ mkdir tutu
%$ mkdir tutu;
%$ cd tutu
%$ system('touch a.m')
%$ system('touch a.m');
%$ cd ..
%$ system('touch b.m')
%$ system('touch c.m')
%$ system('touch b.m');
%$ system('touch c.m');
%$ cd ../titi
%$ system('touch d.m')
%$ system('touch d.m');
%$ cd ..
%$ pause(1)
%$ system('touch e.m')
%$ system('touch e.m');
%$ t(1) = isequal(isolder('e.m'), false);
%$ pause(1)
%$ system('touch tata/tutu/a.m')
%$ system('touch tata/b.m')
%$ system('touch tata/c.m')
%$ system('touch titi/d.m')
%$ system('touch tata/tutu/a.m');
%$ system('touch tata/b.m');
%$ system('touch tata/c.m');
%$ system('touch titi/d.m');
%$ t(2) = isequal(isolder('e.m'), true);
%$ pause(1)
%$ system('touch e.m')
%$ system('touch e.m');
%$ t(3) = isequal(isolder('e.m'), false);
%$ cd ..
%$ if isoctave()
......