Added comments and cosmetics.

time-shift
Stéphane Adjemian (Scylla) 2013-11-28 10:57:54 +01:00
parent be4a53e4fa
commit 4fa2d5b8e9
2 changed files with 12 additions and 14 deletions

View File

@ -30,11 +30,12 @@ function dynare_estimation(var_list,dname)
global options_ oo_ M_ oo_recursive_ global options_ oo_ M_ oo_recursive_
% Test if the order of approximation is nonzero (the preprocessor tests if order is non negative).
if isequal(options_.order,0) if isequal(options_.order,0)
error('Estimation:: The order of the Taylor approximation cannot be 0!') error('Estimation:: The order of the Taylor approximation cannot be 0!')
end end
%% Decide if a DSGE or DSGE-VAR has to be estimated. % Decide if a DSGE or DSGE-VAR has to be estimated.
if ~isempty(strmatch('dsge_prior_weight',M_.param_names)) if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
options_.dsge_var = 1; options_.dsge_var = 1;
end end
@ -110,11 +111,9 @@ if nnobs > 1 && horizon > 0
SelecVariables = []; SelecVariables = [];
for i=1:nvar for i=1:nvar
if ~isempty(strmatch(var_list(i,:),endo_names,'exact')) if ~isempty(strmatch(var_list(i,:),endo_names,'exact'))
SelecVariables = [SelecVariables;strmatch(var_list(i,:),endo_names, ... SelecVariables = [SelecVariables;strmatch(var_list(i,:),endo_names, 'exact')];
'exact')];
else else
error(['Estimation: ' var_list(i,:) ' isn''t an endogenous' ... error(['Estimation:: ' var_list(i,:) ' isn''t an endogenous variable'])
'variable'])
end end
end end
end end

View File

@ -19,6 +19,7 @@ function info=stoch_simul(var_list)
global M_ options_ oo_ it_ global M_ options_ oo_ it_
% Test if the order of approximation is nonzero (the preprocessor tests if order is non negative).
if isequal(options_.order,0) if isequal(options_.order,0)
error('stoch_simul:: The order of the Taylor approximation cannot be 0!') error('stoch_simul:: The order of the Taylor approximation cannot be 0!')
end end
@ -44,7 +45,7 @@ end
if options_.partial_information == 1 || options_.ACES_solver == 1 if options_.partial_information == 1 || options_.ACES_solver == 1
PI_PCL_solver = 1; PI_PCL_solver = 1;
if options_.order ~= 1 if options_.order ~= 1
warning('STOCH_SIMUL: forcing order=1 since you are using partial_information or ACES solver') warning('stoch_simul:: forcing order=1 since you are using partial_information or ACES solver')
options_.order = 1; options_.order = 1;
end end
else else
@ -72,8 +73,7 @@ if PI_PCL_solver
[oo_.dr, info] = PCL_resol(oo_.steady_state,0); [oo_.dr, info] = PCL_resol(oo_.steady_state,0);
elseif options_.discretionary_policy elseif options_.discretionary_policy
if ~options_.linear if ~options_.linear
error(['discretionary_policy solves only linear_quadratic ' ... error(['stoch_simul:: discretionary_policy solves only linear_quadratic problems']);
'problems']);
end end
[oo_.dr,ys,info] = discretionary_policy_1(oo_,options_.instruments); [oo_.dr,ys,info] = discretionary_policy_1(oo_,options_.instruments);
else else
@ -127,8 +127,7 @@ end
if options_.periods > 0 && ~PI_PCL_solver if options_.periods > 0 && ~PI_PCL_solver
if options_.periods <= options_.drop if options_.periods <= options_.drop
disp(['STOCH_SIMUL error: The horizon of simulation is shorter' ... disp(['STOCH_SIMUL error: The horizon of simulation is shorter than the number of observations to be dropped'])
' than the number of observations to be dropped'])
options_ =options_old; options_ =options_old;
return return
end end
@ -181,9 +180,9 @@ if options_.irf
options_.replic, options_.order); options_.replic, options_.order);
end end
if ~options_.noprint && any(any(isnan(y))) && ~options_.pruning && ~(options_.order==1) if ~options_.noprint && any(any(isnan(y))) && ~options_.pruning && ~(options_.order==1)
fprintf('\nSTOCH_SIMUL: The simulations conducted for generating IRFs to %s were explosive.\n',M_.exo_names(i,:)) fprintf('\nstoch_simul:: The simulations conducted for generating IRFs to %s were explosive.\n',M_.exo_names(i,:))
fprintf('STOCH_SIMUL: No IRFs will be displayed. Either reduce the shock size, \n') fprintf('stoch_simul:: No IRFs will be displayed. Either reduce the shock size, \n')
fprintf('STOCH_SIMUL: use pruning, or set the approximation order to 1.'); fprintf('stoch_simul:: use pruning, or set the approximation order to 1.');
skipline(2); skipline(2);
end end
if options_.relative_irf if options_.relative_irf
@ -215,7 +214,7 @@ if options_.irf
end end
else else
if options_.debug if options_.debug
fprintf('STOCH_SIMUL: The IRF of %s to %s is smaller than the irf_plot_threshold of %4.3f and will not be displayed.\n',deblank(M_.endo_names(i_var(j),:)),deblank(M_.exo_names(i,:)),options_.impulse_responses.plot_threshold) fprintf('stoch_simul:: The IRF of %s to %s is smaller than the irf_plot_threshold of %4.3f and will not be displayed.\n',deblank(M_.endo_names(i_var(j),:)),deblank(M_.exo_names(i,:)),options_.impulse_responses.plot_threshold)
end end
end end
end end