From 1d7634994972fd73383102e275a6b2c62ee78563 Mon Sep 17 00:00:00 2001 From: Selma Malmberg <selma@dynare.org> Date: Thu, 1 Apr 2021 11:07:28 +0200 Subject: [PATCH] Use of the compute_decision_rules function to factorize code (Ref.#173) Corrections: put resol back where needed. --- ...e_simulated_theoretical_conditional_variance_decomposition.m | 2 +- matlab/dsge_simulated_theoretical_correlation.m | 2 +- matlab/dsge_simulated_theoretical_covariance.m | 2 +- matlab/dsge_simulated_theoretical_variance_decomposition.m | 2 +- matlab/identification_analysis.m | 2 +- matlab/osr1.m | 2 +- matlab/osr_obj.m | 2 +- matlab/reversed_extended_path.m | 2 +- matlab/selec_posterior_draws.m | 2 +- matlab/simulated_moment_uncertainty.m | 2 +- matlab/stoch_simul.m | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m index 23cdfdff19..c85ca9b118 100644 --- a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m @@ -142,7 +142,7 @@ for file = 1:NumberOfDrawsFiles dr = temp.pdraws{linee,2}; else M_=set_parameters_locally(M_,temp.pdraws{linee,1}); - [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_) end if first_call endo_nbr = M_.endo_nbr; diff --git a/matlab/dsge_simulated_theoretical_correlation.m b/matlab/dsge_simulated_theoretical_correlation.m index 50001e153b..e77af705b2 100644 --- a/matlab/dsge_simulated_theoretical_correlation.m +++ b/matlab/dsge_simulated_theoretical_correlation.m @@ -115,7 +115,7 @@ for file = 1:NumberOfDrawsFiles dr = temp.pdraws{linee,2}; else M_=set_parameters_locally(M_,temp.pdraws{linee,1}); - [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); end if ~options_.pruning tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition); diff --git a/matlab/dsge_simulated_theoretical_covariance.m b/matlab/dsge_simulated_theoretical_covariance.m index 86660c86d9..d23fafc05b 100644 --- a/matlab/dsge_simulated_theoretical_covariance.m +++ b/matlab/dsge_simulated_theoretical_covariance.m @@ -113,7 +113,7 @@ for file = 1:NumberOfDrawsFiles dr = temp.pdraws{linee,2}; else M_=set_parameters_locally(M_,temp.pdraws{linee,1}); - [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); end if ~options_.pruning tmp = th_autocovariances(dr,ivar,M_,options_,nodecomposition); diff --git a/matlab/dsge_simulated_theoretical_variance_decomposition.m b/matlab/dsge_simulated_theoretical_variance_decomposition.m index e17865aaeb..7d5574721b 100644 --- a/matlab/dsge_simulated_theoretical_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_variance_decomposition.m @@ -141,7 +141,7 @@ for file = 1:NumberOfDrawsFiles dr = temp.pdraws{linee,2}; else M_=set_parameters_locally(M_,temp.pdraws{linee,1}); - [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); end if file==1 && linee==1 [tmp, stationary_vars] = th_autocovariances(dr,ivar,M_,options_,nodecomposition); diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index ff773195cf..5f2b47660e 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -133,7 +133,7 @@ no_identification_minimal = options_ident.no_identification_minimal; no_identification_spectrum = options_ident.no_identification_spectrum; %Compute linear approximation and fill dr structure -[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); +[oo_.dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); if info(1) == 0 %no errors in solution % Compute parameter Jacobians for identification analysis diff --git a/matlab/osr1.m b/matlab/osr1.m index 673f69bdc9..ecf5196213 100644 --- a/matlab/osr1.m +++ b/matlab/osr1.m @@ -143,7 +143,7 @@ if ~options_.noprint fprintf('Objective function : %16.6g\n\n',f); skipline() end -[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); +[oo_.dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); if ~info osr_res.error_indicator=0; end \ No newline at end of file diff --git a/matlab/osr_obj.m b/matlab/osr_obj.m index 76db1da69c..d6d85d4601 100644 --- a/matlab/osr_obj.m +++ b/matlab/osr_obj.m @@ -47,7 +47,7 @@ M_.params(i_params) = x; % don't change below until the part where the loss function is computed it_ = M_.maximum_lag+1; -[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); +[dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); if info(1) if info(1) == 3 || info(1) == 4 || info(1) == 5 || info(1)==6 ||info(1) == 19 ||... diff --git a/matlab/reversed_extended_path.m b/matlab/reversed_extended_path.m index e65204767a..748423d992 100644 --- a/matlab/reversed_extended_path.m +++ b/matlab/reversed_extended_path.m @@ -48,7 +48,7 @@ steady_; % Compute the first order perturbation reduced form. old_options_order = options_.order; options_.order = 1; -[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); +[dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); oo_.dr = dr; options_.order = old_options_order; diff --git a/matlab/selec_posterior_draws.m b/matlab/selec_posterior_draws.m index c42e1ced80..dd336f2fb4 100644 --- a/matlab/selec_posterior_draws.m +++ b/matlab/selec_posterior_draws.m @@ -142,7 +142,7 @@ if info pdraws(linee,1) = {x2(SampleAddress(i,4),:)}; if info-1 set_parameters(pdraws{linee,1}); - [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); pdraws(linee,2) = { dr }; end old_mhfile = mhfile; diff --git a/matlab/simulated_moment_uncertainty.m b/matlab/simulated_moment_uncertainty.m index 8a892cc5ae..152ac6b5cb 100644 --- a/matlab/simulated_moment_uncertainty.m +++ b/matlab/simulated_moment_uncertainty.m @@ -71,7 +71,7 @@ else logged_steady_state_indicator=0; end -[dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); +[dr,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); oo_.dr=dr; if info(1) fprintf('\nsimulated_moment_uncertainty: model could not be solved') diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m index 69c0ae521a..4db2049945 100644 --- a/matlab/stoch_simul.m +++ b/matlab/stoch_simul.m @@ -106,7 +106,7 @@ else oo_.steady_state=exp(oo_.steady_state); options_.logged_steady_state=0; end - [~,info,M_,options_,oo_] = resol(0,M_,options_,oo_); + [~,info,M_,options_,oo_] = compute_decision_rules(M_,options_,oo_); end if options_.loglinear && isfield(oo_.dr,'ys') && options_.logged_steady_state==0 %log steady state for correct display of decision rule -- GitLab