From 7a75872f72e2dc0359346dc32fca89669cdca961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 13 Nov 2018 17:58:42 +0100 Subject: [PATCH] Modernization: use tilde (~) syntax for ignored output arguments --- matlab/PosteriorIRF_core1.m | 2 +- matlab/WriteShockDecomp2Excel.m | 2 +- matlab/annualized_shock_decomposition.m | 4 ++-- matlab/bksupk.m | 6 ++--- matlab/check_list_of_variables.m | 2 +- matlab/check_posterior_sampler_options.m | 4 ++-- matlab/discretionary_policy_1.m | 4 ++-- matlab/dr_block.m | 4 ++-- matlab/draw_prior_density.m | 2 +- matlab/dyn_first_order_solver.m | 4 ++-- matlab/dyn_ramsey_static.m | 8 +++---- matlab/dyn_risky_steadystate_solver.m | 2 +- matlab/dyn_second_order_solver.m | 4 ++-- matlab/dynare.m | 2 +- matlab/dynare_estimation_1.m | 9 ++++--- matlab/dynare_estimation_init.m | 22 ++++++++--------- matlab/dynare_gradient.m | 4 ++-- matlab/evaluate_steady_state.m | 2 +- matlab/execute_prior_posterior_function.m | 2 +- matlab/getH.m | 4 ++-- matlab/get_name_of_the_last_mh_file.m | 2 +- matlab/global_initialization.m | 4 ++-- matlab/graph_decomp.m | 2 +- matlab/graph_decomp_detail.m | 2 +- matlab/gsa/prior_draw_gsa.m | 2 +- matlab/gsa/stab_map_.m | 2 +- matlab/identification_analysis.m | 2 +- matlab/initial_condition_decomposition.m | 2 +- matlab/initial_estimation_checks.m | 4 ++-- matlab/kalman/likelihood/kalman_filter_ss.m | 4 ++-- .../likelihood/univariate_kalman_filter_ss.m | 2 +- matlab/lmmcp/lmmcp.m | 2 +- matlab/load_m_file_data_legacy.m | 4 ++-- matlab/model_diagnostics.m | 18 +++++++------- matlab/occbin/get_coef.m | 10 ++++---- matlab/optimization/csminwel1.m | 8 +++---- matlab/optimization/numgrad3_.m | 4 ++-- matlab/optimization/numgrad5_.m | 8 +++---- .../simplex_optimization_routine.m | 6 ++--- matlab/partial_information/dr1_PI.m | 6 ++--- .../det_cond_forecast.m | 10 ++++---- .../perfect_foresight_solver.m | 4 ++-- .../perfect_foresight_solver_core.m | 6 ++--- .../private/initialize_stacked_problem.m | 4 ++-- .../private/simulation_core.m | 6 ++--- matlab/prior_posterior_statistics_core.m | 2 +- matlab/realtime_shock_decomposition.m | 9 ++++--- matlab/shock_decomposition.m | 2 +- matlab/simulated_moments_estimation.m | 2 +- matlab/stochastic_solvers.m | 24 +++++++++---------- matlab/store_smoother_results.m | 2 +- matlab/user_has_matlab_license.m | 2 +- .../utilities/general/clean_current_folder.m | 2 +- matlab/varlist_indices.m | 2 +- 54 files changed, 131 insertions(+), 133 deletions(-) diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m index fb909f889..7fa1716f6 100644 --- a/matlab/PosteriorIRF_core1.m +++ b/matlab/PosteriorIRF_core1.m @@ -194,7 +194,7 @@ while fpar. % Get uniques -[junk1, junk2, index_uniques] = varlist_indices(varlist, M_.endo_names); +[~, ~, index_uniques] = varlist_indices(varlist, M_.endo_names); varlist = varlist(index_uniques); msg = false; diff --git a/matlab/check_posterior_sampler_options.m b/matlab/check_posterior_sampler_options.m index 4683639f3..0cb507586 100644 --- a/matlab/check_posterior_sampler_options.m +++ b/matlab/check_posterior_sampler_options.m @@ -387,7 +387,7 @@ if ~strcmp(posterior_sampler_options.posterior_sampling_method,'slice') end if options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix - [junk, invhess] = compute_mh_covariance_matrix; + [~, invhess] = compute_mh_covariance_matrix; posterior_sampler_options.invhess = invhess; end @@ -409,7 +409,7 @@ if strcmp(posterior_sampler_options.posterior_sampling_method,'slice') error('check_posterior_sampler_options:: This error should not occur, please contact developers.') end % % % if options_.load_mh_file && options_.use_mh_covariance_matrix, - % % % [junk, invhess] = compute_mh_covariance_matrix; + % % % [~, invhess] = compute_mh_covariance_matrix; % % % posterior_sampler_options.invhess = invhess; % % % end [V1, D]=eig(invhess); diff --git a/matlab/discretionary_policy_1.m b/matlab/discretionary_policy_1.m index f154912d4..91586970b 100644 --- a/matlab/discretionary_policy_1.m +++ b/matlab/discretionary_policy_1.m @@ -63,7 +63,7 @@ end %call steady_state_file if present to update parameters if options_.steadystate_flag % explicit steady state file - [junk,M_.params,info] = evaluate_steady_state_file(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_, ... + [~,M_.params,info] = evaluate_steady_state_file(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_, ... options_,0); end [U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params); @@ -129,7 +129,7 @@ iter=1; for j=1:numel(Indices) eval(['A',Indices{j},'=zeros(eq_nbr,endo_nbr);']) if strcmp(Indices{j},'0')||(strcmp(Indices{j},'lag') && MaxLag)||(strcmp(Indices{j},'lead') && MaxLead) - [junk,row,col]=find(lead_lag_incidence(iter,:)); + [~,row,col]=find(lead_lag_incidence(iter,:)); eval(['A',Indices{j},'(:,row)=jacobia_(:,col);']) iter=iter+1; end diff --git a/matlab/dr_block.m b/matlab/dr_block.m index 0b4d676ee..c0209d527 100644 --- a/matlab/dr_block.m +++ b/matlab/dr_block.m @@ -409,7 +409,7 @@ for i = 1:Size index_c = lead_lag_incidence(2,:); % Index of all endogenous variables present at time=t index_s = lead_lag_incidence(2,1:n_static); % Index of all static endogenous variables present at time=t if n_static > 0 - [Q, junk] = qr(jacob(:,index_s)); + [Q, ~] = qr(jacob(:,index_s)); aa = Q'*jacob; else aa = jacob; @@ -476,7 +476,7 @@ for i = 1:Size if isfield(options_,'indeterminacy_continuity') if options_.indeterminacy_msv == 1 [ss,tt,w,q] = qz(E',D'); - [ss,tt,w,junk] = reorder(ss,tt,w,q); + [ss,tt,w,~] = reorder(ss,tt,w,q); ss = ss'; tt = tt'; w = w'; diff --git a/matlab/draw_prior_density.m b/matlab/draw_prior_density.m index 8e9ff93c6..b5d993e85 100644 --- a/matlab/draw_prior_density.m +++ b/matlab/draw_prior_density.m @@ -111,7 +111,7 @@ switch pshape(indx) end if pshape(indx) ~= 5 - [junk,k1] = max(dens); + [~,k1] = max(dens); if k1 == 1 || k1 == length(dens) k = find(dens > 10); dens(k) = NaN; diff --git a/matlab/dyn_first_order_solver.m b/matlab/dyn_first_order_solver.m index 698197167..c7f97e9b5 100644 --- a/matlab/dyn_first_order_solver.m +++ b/matlab/dyn_first_order_solver.m @@ -124,7 +124,7 @@ if isempty(reorder_jacobian_columns) nsfwrd)))]; index_e2 = npred+nboth+(1:nboth); - [junk,cols_b] = find(lead_lag_incidence(maximum_lag+1, order_var)); + [~,cols_b] = find(lead_lag_incidence(maximum_lag+1, order_var)); reorder_jacobian_columns = [nonzeros(lead_lag_incidence(:,order_var)'); ... nz+(1:exo_nbr)']; @@ -138,7 +138,7 @@ dr.state_var = state_var; jacobia = jacobia(:,reorder_jacobian_columns); if nstatic > 0 - [Q, junk] = qr(jacobia(:,index_s)); + [Q, ~] = qr(jacobia(:,index_s)); aa = Q'*jacobia; else aa = jacobia; diff --git a/matlab/dyn_ramsey_static.m b/matlab/dyn_ramsey_static.m index cf171e847..ccbad5e7b 100644 --- a/matlab/dyn_ramsey_static.m +++ b/matlab/dyn_ramsey_static.m @@ -75,7 +75,7 @@ elseif options_.steadystate_flag ys_init(k_inst) = inst_val; exo_ss = [oo.exo_steady_state oo.exo_det_steady_state]; [xx,params] = evaluate_steady_state_file(ys_init,exo_ss,M,options_,~options_.steadystate.nocheck); %run steady state file again to update parameters - [junk,junk,steady_state] = nl_func(inst_val); %compute and return steady state + [~,~,steady_state] = nl_func(inst_val); %compute and return steady state else n_var = M.orig_endo_nbr; xx = oo.steady_state(1:n_var); @@ -85,7 +85,7 @@ else if info1~=0 check=81; end - [junk,junk,steady_state] = nl_func(xx); + [~,~,steady_state] = nl_func(xx); end @@ -194,8 +194,8 @@ end function result = check_static_model(ys,M,options_,oo) result = false; if (options_.bytecode) - [chck, res, junk] = bytecode('static',ys,[oo.exo_steady_state oo.exo_det_steady_state], ... - M.params, 'evaluate'); + [chck, res, ~] = bytecode('static',ys,[oo.exo_steady_state oo.exo_det_steady_state], ... + M.params, 'evaluate'); else res = feval([M.fname '.static'],ys,[oo.exo_steady_state oo.exo_det_steady_state], ... M.params); diff --git a/matlab/dyn_risky_steadystate_solver.m b/matlab/dyn_risky_steadystate_solver.m index a17e21326..04c50b84b 100644 --- a/matlab/dyn_risky_steadystate_solver.m +++ b/matlab/dyn_risky_steadystate_solver.m @@ -88,7 +88,7 @@ exo_nbr = M.exo_nbr; M.var_order_endo_names = M.endo_names(dr.order_var); -[junk,dr.i_fwrd_g,i_fwrd_f] = find(lead_lag_incidence(3,order_var)); +[~,dr.i_fwrd_g,i_fwrd_f] = find(lead_lag_incidence(3,order_var)); dr.i_fwrd_f = i_fwrd_f; nd = nnz(lead_lag_incidence) + M.exo_nbr; dr.nd = nd; diff --git a/matlab/dyn_second_order_solver.m b/matlab/dyn_second_order_solver.m index df6ba7693..5040d1493 100644 --- a/matlab/dyn_second_order_solver.m +++ b/matlab/dyn_second_order_solver.m @@ -105,7 +105,7 @@ k1 = find(kstate(:,2) == M_.maximum_endo_lag+2); % Jacobian with respect to the variables with the highest lead fyp = jacobia(:,kstate(k1,3)+nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:))); B(:,nstatic+M_.npred+1:end) = fyp; -[junk,k1,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+M_.maximum_endo_lead+1,order_var)); +[~,k1,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+M_.maximum_endo_lead+1,order_var)); A(1:M_.endo_nbr,nstatic+1:nstatic+nspred)=... A(1:M_.endo_nbr,nstatic+[1:nspred])+fyp*gx1(k1,1:nspred); C = Gy; @@ -162,7 +162,7 @@ kp = sum(kstate(:,2) <= M_.maximum_endo_lag+1); E1 = [eye(nspred); zeros(kp-nspred,nspred)]; H = E1; hxx = dr.ghxx(nstatic+[1:nspred],:); -[junk,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+2,order_var)); +[~,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+2,order_var)); k3 = nnz(M_.lead_lag_incidence(1:M_.maximum_endo_lag+1,:))+(1:M_.nsfwrd)'; [B1, err] = sparse_hessian_times_B_kronecker_C(hessian_mat(:,kh(k3,k3)),gu(k2a,:),threads_BC); mexErrCheck('sparse_hessian_times_B_kronecker_C', err); diff --git a/matlab/dynare.m b/matlab/dynare.m index fa3808803..00f18c377 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -191,7 +191,7 @@ end if ispc arch = getenv('PROCESSOR_ARCHITECTURE'); else - [junk, arch] = system('uname -m'); + [~, arch] = system('uname -m'); end if isempty(strfind(arch, '64')) diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index a0eb52924..776adbaa0 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -235,8 +235,8 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation if options_.analytic_derivation && strcmp(func2str(objective_function),'dsge_likelihood') ana_deriv_old = options_.analytic_derivation; options_.analytic_derivation = 2; - [junk1, junk2,junk3, junk4, hh] = feval(objective_function,xparam1, ... - dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_); + [~,~,~,~,hh] = feval(objective_function,xparam1, ... + dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_); options_.analytic_derivation = ana_deriv_old; elseif ~isnumeric(options_.mode_compute) || ~(isequal(options_.mode_compute,5) && newratflag~=1 && strcmp(func2str(objective_function),'dsge_likelihood')) % with flag==0, we force to use the hessian from outer product gradient of optimizer 5 @@ -373,9 +373,8 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation skipline() end if options_.dsge_var - [junk1,junk2,junk3,junk4,junk5,junk6,junk7,oo_.dsge_var.posterior_mode.PHI_tilde,oo_.dsge_var.posterior_mode.SIGMA_u_tilde,oo_.dsge_var.posterior_mode.iXX,oo_.dsge_var.posterior_mode.prior] =... + [~,~,~,~,~,~,~,oo_.dsge_var.posterior_mode.PHI_tilde,oo_.dsge_var.posterior_mode.SIGMA_u_tilde,oo_.dsge_var.posterior_mode.iXX,oo_.dsge_var.posterior_mode.prior] =... feval(objective_function,xparam1,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_); - clear('junk1','junk2','junk3','junk4','junk5','junk6','junk7'); end elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation @@ -519,7 +518,7 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ... oo_.posterior.metropolis=oo_load_mh.oo_.posterior.metropolis; end end - [error_flag,junk,options_]= metropolis_draw(1,options_,estim_params_,M_); + [error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_); if options_.bayesian_irf if error_flag error('Estimation::mcmc: I cannot compute the posterior IRFs!') diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m index fb4575209..7676c6445 100644 --- a/matlab/dynare_estimation_init.m +++ b/matlab/dynare_estimation_init.m @@ -454,38 +454,38 @@ if options_.block == 1 % Set restrict_state to postion of observed + state variables in expanded state vector. oo_.dr.restrict_var_list = [k1(i_posA) M_.state_var(sort(i_posB))]; % set mf0 to positions of state variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf0] = ismember(M_.state_var',oo_.dr.restrict_var_list); + [~,bayestopt_.mf0] = ismember(M_.state_var',oo_.dr.restrict_var_list); % Set mf1 to positions of observed variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf1] = ismember(k1,oo_.dr.restrict_var_list); + [~,bayestopt_.mf1] = ismember(k1,oo_.dr.restrict_var_list); % Set mf2 to positions of observed variables in expanded state vector for filtering and smoothing. bayestopt_.mf2 = var_obs_index_dr; bayestopt_.mfys = k1; oo_.dr.restrict_columns = [size(i_posA,1)+(1:size(M_.state_var,2))]; [k2, i_posA, i_posB] = union(k3p, M_.state_var', 'rows'); bayestopt_.smoother_var_list = [k3p(i_posA); M_.state_var(sort(i_posB))']; - [junk,junk,bayestopt_.smoother_saved_var_list] = intersect(k3p,bayestopt_.smoother_var_list(:)); - [junk,ic] = intersect(bayestopt_.smoother_var_list,M_.state_var); + [~,~,bayestopt_.smoother_saved_var_list] = intersect(k3p,bayestopt_.smoother_var_list(:)); + [~,ic] = intersect(bayestopt_.smoother_var_list,M_.state_var); bayestopt_.smoother_restrict_columns = ic; - [junk,bayestopt_.smoother_mf] = ismember(k1, bayestopt_.smoother_var_list); + [~,bayestopt_.smoother_mf] = ismember(k1, bayestopt_.smoother_var_list); else % Define union of observed and state variables k2 = union(var_obs_index_dr,[M_.nstatic+1:M_.nstatic+M_.nspred]', 'rows'); % Set restrict_state to postion of observed + state variables in expanded state vector. oo_.dr.restrict_var_list = k2; % set mf0 to positions of state variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf0] = ismember([M_.nstatic+1:M_.nstatic+M_.nspred]',k2); + [~,bayestopt_.mf0] = ismember([M_.nstatic+1:M_.nstatic+M_.nspred]',k2); % Set mf1 to positions of observed variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf1] = ismember(var_obs_index_dr,k2); + [~,bayestopt_.mf1] = ismember(var_obs_index_dr,k2); % Set mf2 to positions of observed variables in expanded state vector for filtering and smoothing. bayestopt_.mf2 = var_obs_index_dr; bayestopt_.mfys = k1; - [junk,ic] = intersect(k2,nstatic+(1:npred)'); + [~,ic] = intersect(k2,nstatic+(1:npred)'); oo_.dr.restrict_columns = [ic; length(k2)+(1:nspred-npred)']; bayestopt_.smoother_var_list = union(k2,k3); - [junk,junk,bayestopt_.smoother_saved_var_list] = intersect(k3,bayestopt_.smoother_var_list(:)); - [junk,ic] = intersect(bayestopt_.smoother_var_list,nstatic+(1:npred)'); + [~,~,bayestopt_.smoother_saved_var_list] = intersect(k3,bayestopt_.smoother_var_list(:)); + [~,ic] = intersect(bayestopt_.smoother_var_list,nstatic+(1:npred)'); bayestopt_.smoother_restrict_columns = ic; - [junk,bayestopt_.smoother_mf] = ismember(var_obs_index_dr, bayestopt_.smoother_var_list); + [~,bayestopt_.smoother_mf] = ismember(var_obs_index_dr, bayestopt_.smoother_var_list); end if options_.analytic_derivation diff --git a/matlab/dynare_gradient.m b/matlab/dynare_gradient.m index 2f4dfc9d4..71e9da33e 100644 --- a/matlab/dynare_gradient.m +++ b/matlab/dynare_gradient.m @@ -52,11 +52,11 @@ for i=1:m else h = H(:,i); end - [Fh,junk1,junk2,flag] = feval(fcn, x+transpose(h), varargin{:}); + [Fh,~,~,flag] = feval(fcn, x+transpose(h), varargin{:}); if flag G(:,i) = (Fh-F)/epsilon; else - [Fh,junk1,junk2,flag] = feval(fcn, x-transpose(h), varargin{:}); + [Fh,~,~,flag] = feval(fcn, x-transpose(h), varargin{:}); if flag G(:,i) = (F-Fh)/epsilon; else diff --git a/matlab/evaluate_steady_state.m b/matlab/evaluate_steady_state.m index 993148fc1..9293d53ac 100644 --- a/matlab/evaluate_steady_state.m +++ b/matlab/evaluate_steady_state.m @@ -307,7 +307,7 @@ 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, ~]= bytecode('dynamic','evaluate', z, zx, M.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); diff --git a/matlab/execute_prior_posterior_function.m b/matlab/execute_prior_posterior_function.m index cb7884e83..e998dd19b 100644 --- a/matlab/execute_prior_posterior_function.m +++ b/matlab/execute_prior_posterior_function.m @@ -55,7 +55,7 @@ if strcmpi(type,'posterior') CutSample(M_, options_, estim_params_); %% initialize metropolis draws options_.sub_draws=n_draws; %set draws for sampling; changed value is not returned to base workspace - [error_flag,junk,options_]= metropolis_draw(1,options_,estim_params_,M_); + [error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_); if error_flag error('EXECUTE_POSTERIOR_FUNCTION: The draws could not be initialized') end diff --git a/matlab/getH.m b/matlab/getH.m index a7de28bc0..efd53d9d6 100644 --- a/matlab/getH.m +++ b/matlab/getH.m @@ -319,8 +319,8 @@ if nargout > 5 end end -[junk,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ... - oo_.dr.order_var)); +[~,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ... + oo_.dr.order_var)); GAM0 = zeros(M_.endo_nbr,M_.endo_nbr); Dg0 = zeros(M_.endo_nbr,M_.endo_nbr,param_nbr); GAM0(:,cols_b) = g1(:,cols_j); diff --git a/matlab/get_name_of_the_last_mh_file.m b/matlab/get_name_of_the_last_mh_file.m index e6732a2ef..2741f7b52 100644 --- a/matlab/get_name_of_the_last_mh_file.m +++ b/matlab/get_name_of_the_last_mh_file.m @@ -43,7 +43,7 @@ bk_number = record.Nblck ; predicted_mhname = [ BaseName '_mh' int2str(mh_number) '_blck' int2str(bk_number) '.mat' ] ; all_mh_files = dir([BaseName '_mh*_blck*' ]); -[junk,idx] = sort([all_mh_files.datenum]); +[~,idx] = sort([all_mh_files.datenum]); mhname = all_mh_files(idx(end)).name; if ~strcmpi(mhname,predicted_mhname) diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 6a1acadc9..93c1e8ad6 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -130,8 +130,8 @@ set_dynare_seed('default'); % Create directories -[junk,junk]=mkdir(M_.fname); -[junk,junk]=mkdir([M_.fname filesep 'Output']); +[~,~]=mkdir(M_.fname); +[~,~]=mkdir([M_.fname filesep 'Output']); % Load user configuration file. if isfield(options_, 'global_init_file') diff --git a/matlab/graph_decomp.m b/matlab/graph_decomp.m index 7b150a5da..eda542009 100644 --- a/matlab/graph_decomp.m +++ b/matlab/graph_decomp.m @@ -108,7 +108,7 @@ comp_nbr0=comp_nbr; for j=1:nvar z1 = squeeze(z(i_var(j),:,:)); if screen_shocks - [junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend'); + [~, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend'); labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values'); zres = sum(z1(isort(17:end),:),1); z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)]; diff --git a/matlab/graph_decomp_detail.m b/matlab/graph_decomp_detail.m index 2605dbac3..9b920770b 100644 --- a/matlab/graph_decomp_detail.m +++ b/matlab/graph_decomp_detail.m @@ -135,7 +135,7 @@ comp_nbr0=comp_nbr; for j=1:nvar z1 = squeeze(z(i_var(j),:,:)); if screen_shocks, - [junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend'); + [~, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend'); labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values'); zres = sum(z1(isort(17:end),:),1); z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)]; diff --git a/matlab/gsa/prior_draw_gsa.m b/matlab/gsa/prior_draw_gsa.m index c3c92d40d..d772ae22a 100644 --- a/matlab/gsa/prior_draw_gsa.m +++ b/matlab/gsa/prior_draw_gsa.m @@ -49,7 +49,7 @@ if init pdraw = zeros(npar,1); lbcum = zeros(npar,1); ubcum = ones(npar,1); - [junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds + [~,~,~,lb,ub,~] = set_prior(estim_params_,M_,options_); %Prepare bounds if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0) % Set prior bounds bounds = prior_bounds(bayestopt_, options_.prior_trunc); diff --git a/matlab/gsa/stab_map_.m b/matlab/gsa/stab_map_.m index f4f73188c..15c6f22a5 100644 --- a/matlab/gsa/stab_map_.m +++ b/matlab/gsa/stab_map_.m @@ -92,7 +92,7 @@ p2 = bayestopt_.p2(nshock+1:end); p3 = bayestopt_.p3(nshock+1:end); p4 = bayestopt_.p4(nshock+1:end); -[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds +[~,~,~,lb,ub,~] = set_prior(estim_params_,M_,options_); %Prepare bounds if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0) % Set prior bounds bounds = prior_bounds(bayestopt_, options_.prior_trunc); diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index bc4d8ad86..69b10efad 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -198,7 +198,7 @@ if info(1)==0 if isoctave || matlab_ver_less_than('8.3') [V,D]=eig(cc); %fix for older Matlab versions that do not support computing left eigenvalues, see http://mathworks.com/help/releases/R2012b/matlab/ref/eig.html - [W,junk] = eig(cc.'); + [W,~] = eig(cc.'); W = conj(W); else [V,D,W]=eig(cc); diff --git a/matlab/initial_condition_decomposition.m b/matlab/initial_condition_decomposition.m index 52e468a9f..0c846b1ff 100644 --- a/matlab/initial_condition_decomposition.m +++ b/matlab/initial_condition_decomposition.m @@ -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,M,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); + [oo,M,~,~,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); % reduced form dr = oo.dr; diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m index bc7d9fb20..05972ef30 100644 --- a/matlab/initial_estimation_checks.m +++ b/matlab/initial_estimation_checks.m @@ -66,7 +66,7 @@ if isfield(EstimatedParameters,'param_vals') && ~isempty(EstimatedParameters.par %check whether steady state file changes estimated parameters Model_par_varied=Model; %store Model structure Model_par_varied.params(EstimatedParameters.param_vals(:,1))=Model_par_varied.params(EstimatedParameters.param_vals(:,1))*1.01; %vary parameters - [junk, new_steady_params_2] = evaluate_steady_state(DynareResults.steady_state,Model_par_varied,DynareOptions,DynareResults,DynareOptions.diffuse_filter==0); + [~, new_steady_params_2] = evaluate_steady_state(DynareResults.steady_state,Model_par_varied,DynareOptions,DynareResults,DynareOptions.diffuse_filter==0); changed_par_indices=find((old_steady_params(EstimatedParameters.param_vals(:,1))-new_steady_params(EstimatedParameters.param_vals(:,1))) ... | (Model_par_varied.params(EstimatedParameters.param_vals(:,1))-new_steady_params_2(EstimatedParameters.param_vals(:,1)))); @@ -105,7 +105,7 @@ end % display warning if some parameters are still NaN test_for_deep_parameters_calibration(Model); -[lnprior, junk1,junk2,info]= priordens(xparam1,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4); +[lnprior,~,~,info]= priordens(xparam1,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4); if 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') diff --git a/matlab/kalman/likelihood/kalman_filter_ss.m b/matlab/kalman/likelihood/kalman_filter_ss.m index 5510de9f3..d8dc80468 100644 --- a/matlab/kalman/likelihood/kalman_filter_ss.m +++ b/matlab/kalman/likelihood/kalman_filter_ss.m @@ -114,9 +114,9 @@ while t <= last tmp = (a+K*v); if analytic_derivation if analytic_derivation==2 - [Da,junk,DLIKt,D2a,junk2, Hesst] = computeDLIK(k,tmp,Z,Zflag,v,T,K,[],iF,Da,DYss,DT,[],[],[],notsteady,D2a,D2Yss,D2T,[],[]); + [Da,~,DLIKt,D2a,~, Hesst] = computeDLIK(k,tmp,Z,Zflag,v,T,K,[],iF,Da,DYss,DT,[],[],[],notsteady,D2a,D2Yss,D2T,[],[]); else - [Da,junk,DLIKt,Hesst] = computeDLIK(k,tmp,Z,Zflag,v,T,K,[],iF,Da,DYss,DT,[],[],[],notsteady); + [Da,~,DLIKt,Hesst] = computeDLIK(k,tmp,Z,Zflag,v,T,K,[],iF,Da,DYss,DT,[],[],[],notsteady); end DLIK = DLIK + DLIKt; if analytic_derivation==2 || asy_hess diff --git a/matlab/kalman/likelihood/univariate_kalman_filter_ss.m b/matlab/kalman/likelihood/univariate_kalman_filter_ss.m index 9d8cbff06..e67a87f18 100644 --- a/matlab/kalman/likelihood/univariate_kalman_filter_ss.m +++ b/matlab/kalman/likelihood/univariate_kalman_filter_ss.m @@ -153,7 +153,7 @@ while t<=last end if analytic_derivation if analytic_derivation==2 - [Da,junk,D2a] = univariate_computeDstate(k,a,P,T,Da,DP,DT,[],0,D2a,D2P,D2T); + [Da,~,D2a] = univariate_computeDstate(k,a,P,T,Da,DP,DT,[],0,D2a,D2P,D2T); else Da = univariate_computeDstate(k,a,P,T,Da,DP,DT,[],0); end diff --git a/matlab/lmmcp/lmmcp.m b/matlab/lmmcp/lmmcp.m index 50404ac7c..e5911a474 100644 --- a/matlab/lmmcp/lmmcp.m +++ b/matlab/lmmcp/lmmcp.m @@ -392,7 +392,7 @@ while (k < kmax) && (Psix > eps2) Fx = Fxnew; Phix = Phixnew; Psix = Psixnew; - [junk,DFx] = feval(FUN,x,varargin{:}); + [~,DFx] = feval(FUN,x,varargin{:}); DPhix = DPhi(x,Fx,DFx,lb,ub,lambda1,lambda2,n,Indexset); DPsix = DPhix'*Phix; normDPsix = norm(DPsix); diff --git a/matlab/load_m_file_data_legacy.m b/matlab/load_m_file_data_legacy.m index a78563796..2709fe503 100644 --- a/matlab/load_m_file_data_legacy.m +++ b/matlab/load_m_file_data_legacy.m @@ -18,7 +18,7 @@ function o2WysrOISH = load_m_file_data_legacy(datafile, U7ORsJ0vy3) % --*-- Uni % along with Dynare. If not, see . cXDHdrXnqo5KwwVpTRuc6OprAW = datafile(1:end-2); -[pathtocXDHdrXnqo5KwwVpTRuc6OprAW,cXDHdrXnqo5KwwVpTRuc6OprAW,junk] = fileparts(cXDHdrXnqo5KwwVpTRuc6OprAW); +[pathtocXDHdrXnqo5KwwVpTRuc6OprAW,cXDHdrXnqo5KwwVpTRuc6OprAW,~] = fileparts(cXDHdrXnqo5KwwVpTRuc6OprAW); if ~isempty(pathtocXDHdrXnqo5KwwVpTRuc6OprAW) % We need to change directory, first we keep the current directory in memory... @@ -38,7 +38,7 @@ if ~isempty(pathtocXDHdrXnqo5KwwVpTRuc6OprAW) end % Clear all the variables except the ones defined in the script. -clear('pathtocXDHdrXnqo5KwwVpTRuc6OprAW', 'cXDHdrXnqo5KwwVpTRuc6OprAW', 'junk'); +clear('pathtocXDHdrXnqo5KwwVpTRuc6OprAW', 'cXDHdrXnqo5KwwVpTRuc6OprAW'); % Get the list of variables in the script. mj6F4eU1BN = whos(); diff --git a/matlab/model_diagnostics.m b/matlab/model_diagnostics.m index e8f5ff81c..5696f7726 100644 --- a/matlab/model_diagnostics.m +++ b/matlab/model_diagnostics.m @@ -204,22 +204,22 @@ z = repmat(dr.ys,1,klen); if ~options.block if options.order == 1 if (options.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... - M.params, dr.ys, 1); + [chck, ~, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... + M.params, dr.ys, 1); jacobia_ = [loc_dr.g1 loc_dr.g1_x loc_dr.g1_xd]; else - [junk,jacobia_] = feval([M.fname '.dynamic'],z(iyr0),exo_simul, ... - M.params, dr.ys, it_); + [~,jacobia_] = feval([M.fname '.dynamic'],z(iyr0),exo_simul, ... + M.params, dr.ys, it_); end elseif options.order >= 2 if (options.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... - M.params, dr.ys, 1); + [chck, ~, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... + M.params, dr.ys, 1); jacobia_ = [loc_dr.g1 loc_dr.g1_x]; else - [junk,jacobia_,hessian1] = feval([M.fname '.dynamic'],z(iyr0),... - exo_simul, ... - M.params, dr.ys, it_); + [~,jacobia_,hessian1] = feval([M.fname '.dynamic'],z(iyr0),... + exo_simul, ... + M.params, dr.ys, it_); end if options.use_dll % In USE_DLL mode, the hessian is in the 3-column sparse representation diff --git a/matlab/occbin/get_coef.m b/matlab/occbin/get_coef.m index f2dbde5a6..924be1b1c 100644 --- a/matlab/occbin/get_coef.m +++ b/matlab/occbin/get_coef.m @@ -6,19 +6,19 @@ coef_y = zeros(endo_nbr,3*endo_nbr); coef_u = zeros(endo_nbr,M.exo_nbr); if M.maximum_lag > 0 - [junk,c1,c2] = find(ll(1,:)); + [~,c1,c2] = find(ll(1,:)); coef_y(:,c1) = jacobian(:,c2); - [junk,c1,c2] = find(ll(2,:)); + [~,c1,c2] = find(ll(2,:)); coef_y(:,c1+endo_nbr) = jacobian(:,c2); if M.maximum_lead > 0 - [junk,c1,c2] = find(ll(3,:)); + [~,c1,c2] = find(ll(3,:)); coef_y(:,c1+2*endo_nbr) = jacobian(:,c2); end else - [junk,c1,c2] = find(ll(1,:)); + [~,c1,c2] = find(ll(1,:)); coef_y(:,c1+endo_nbr) = jacobian(:,c2); if M.maximum_lead > 0 - [junk,c1,c2] = find(ll(2,:)); + [~,c1,c2] = find(ll(2,:)); coef_y(:,c1+2*endo_nbr) = jacobian(:,c2); end end diff --git a/matlab/optimization/csminwel1.m b/matlab/optimization/csminwel1.m index cfa869932..902806596 100644 --- a/matlab/optimization/csminwel1.m +++ b/matlab/optimization/csminwel1.m @@ -142,7 +142,7 @@ while ~done elseif ischar(grad) [g1, badg1] = grad(x1,varargin{:}); else - [junk1,cost_flag,g1] = penalty_objective_function(x1,fcn,penalty,varargin{:}); + [~,cost_flag,g1] = penalty_objective_function(x1,fcn,penalty,varargin{:}); badg1 = ~cost_flag; end wall1=badg1; @@ -169,7 +169,7 @@ while ~done elseif ischar(grad) [g2, badg2] = grad(x2,varargin{:}); else - [junk2,cost_flag,g2] = penalty_objective_function(x1,fcn,penalty,varargin{:}); + [~,cost_flag,g2] = penalty_objective_function(x1,fcn,penalty,varargin{:}); badg2 = ~cost_flag; end wall2=badg2; @@ -201,7 +201,7 @@ while ~done elseif ischar(grad) [g3, badg3] = grad(x3,varargin{:}); else - [junk3,cost_flag,g3] = penalty_objective_function(x1,fcn,penalty,varargin{:}); + [~,cost_flag,g3] = penalty_objective_function(x1,fcn,penalty,varargin{:}); badg3 = ~cost_flag; end wall3=badg3; @@ -261,7 +261,7 @@ while ~done elseif ischar(grad) [gh, badgh] = grad(xh,varargin{:}); else - [junkh,cost_flag,gh] = penalty_objective_function(x1,fcn,penalty,varargin{:}); + [~,cost_flag,gh] = penalty_objective_function(x1,fcn,penalty,varargin{:}); badgh = ~cost_flag; end end diff --git a/matlab/optimization/numgrad3_.m b/matlab/optimization/numgrad3_.m index 635813833..a59fa6ae6 100644 --- a/matlab/optimization/numgrad3_.m +++ b/matlab/optimization/numgrad3_.m @@ -46,12 +46,12 @@ for i=1:n xiold = x(i); h = step_length_correction(xiold,scale,i)*delta; x(i) = xiold + h; - [f1,junk1,cost_flag1] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f1,~,cost_flag1] = penalty_objective_function(x, fcn, penalty, varargin{:}); if ~cost_flag1 fprintf('Gradient w.r.t. parameter number %3d (x=%16.8f,+h=%16.8f,f0=%16.8f,f1=%16.8f,f2=%16.8f,g0=%16.8f): penalty on the right!\n',i,xiold,h,f0,f1,f2,(f1 - f2) / (2*h)) end x(i) = xiold - h; - [f2,junk2,cost_flag2] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f2,~,cost_flag2] = penalty_objective_function(x, fcn, penalty, varargin{:}); if ~cost_flag2 fprintf('Gradient w.r.t. parameter number %3d (x=%16.8f,+h=%16.8f,f0=%16.8f,f1=%16.8f,f2=%16.8f,g0=%16.8f): penalty on the left!\n',i,xiold,h,f0,f1,f2,(f1 - f2) / (2*h)) end diff --git a/matlab/optimization/numgrad5_.m b/matlab/optimization/numgrad5_.m index bbce6fd0e..9fbdc9b8e 100644 --- a/matlab/optimization/numgrad5_.m +++ b/matlab/optimization/numgrad5_.m @@ -48,13 +48,13 @@ for i=1:n xiold = x(i); h = step_length_correction(xiold,scale,i)*delta; x(i) = xiold+h; - [f1,junk1,cost_flag1,] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f1,~,cost_flag1,] = penalty_objective_function(x, fcn, penalty, varargin{:}); x(i) = xiold-h; - [f2,junk1,cost_flag2] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f2,~,cost_flag2] = penalty_objective_function(x, fcn, penalty, varargin{:}); x(i) = xiold+2*h; - [f3,junk1,cost_flag3] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f3,~,cost_flag3] = penalty_objective_function(x, fcn, penalty, varargin{:}); x(i) = xiold-2*h; - [f4,junk1,cost_flag4] = penalty_objective_function(x, fcn, penalty, varargin{:}); + [f4,~,cost_flag4] = penalty_objective_function(x, fcn, penalty, varargin{:}); if f00 || length(tct_ruleids)>0 ) diff --git a/matlab/perfect-foresight-models/det_cond_forecast.m b/matlab/perfect-foresight-models/det_cond_forecast.m index 1e4fe53ad..0819820f9 100644 --- a/matlab/perfect-foresight-models/det_cond_forecast.m +++ b/matlab/perfect-foresight-models/det_cond_forecast.m @@ -368,7 +368,7 @@ end save_options_initval_file = options_.initval_file; options_.initval_file = '__'; -[pos_constrained_pf, junk] = find(constrained_perfect_foresight); +[pos_constrained_pf, ~] = find(constrained_perfect_foresight); indx_endo_solve_pf = constrained_vars(pos_constrained_pf); if isempty(indx_endo_solve_pf) pf = 0; @@ -572,7 +572,7 @@ else for t = 1:constrained_periods if direct_mode && ~isempty(is_constraint) - [pos_constrained_pf, junk] = find(constrained_perfect_foresight .* is_constraint(t, :)'); + [pos_constrained_pf, ~] = find(constrained_perfect_foresight .* is_constraint(t, :)'); indx_endo_solve_pf = constrained_vars(pos_constrained_pf); if isempty(indx_endo_solve_pf) pf = 0; @@ -580,7 +580,7 @@ else pf = length(indx_endo_solve_pf); end - [pos_constrained_surprise, junk] = find((1-constrained_perfect_foresight) .* is_constraint(t, :)'); + [pos_constrained_surprise, ~] = find((1-constrained_perfect_foresight) .* is_constraint(t, :)'); indx_endo_solve_surprise = constrained_vars(pos_constrained_surprise); if isempty(indx_endo_solve_surprise) @@ -591,7 +591,7 @@ else end if direct_mode && ~isempty(is_shock) - [pos_shock_pf, junk] = find(shock_perfect_foresight .* is_shock(t, :)'); + [pos_shock_pf, ~] = find(shock_perfect_foresight .* is_shock(t, :)'); indx_endo_solve_pf = shock_vars(pos_shock_pf); if isempty(indx_endo_solve_pf) b_pf = 0; @@ -599,7 +599,7 @@ else b_pf = length(indx_endo_solve_pf); end - [pos_shock_surprise, junk] = find((1-shock_perfect_foresight) .* is_shock(t, :)'); + [pos_shock_surprise, ~] = find((1-shock_perfect_foresight) .* is_shock(t, :)'); indx_endo_solve_surprise = shock_vars(pos_shock_surprise); if isempty(indx_endo_solve_surprise) diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver.m b/matlab/perfect-foresight-models/perfect_foresight_solver.m index c770a630a..17f607ca0 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_solver.m +++ b/matlab/perfect-foresight-models/perfect_foresight_solver.m @@ -179,9 +179,9 @@ if ~isreal(oo_.endo_simul(:)) %can only happen without bytecode yT = real(oo_.endo_simul(:,options_.periods+2)); yy = real(oo_.endo_simul(:,2:options_.periods+1)); illi = M_.lead_lag_incidence'; - [i_cols,junk,i_cols_j] = find(illi(:)); + [i_cols,~,i_cols_j] = find(illi(:)); illi = illi(:,2:3); - [i_cols_J1,junk,i_cols_1] = find(illi(:)); + [i_cols_J1,~,i_cols_1] = find(illi(:)); i_cols_T = nonzeros(M_.lead_lag_incidence(1:2,:)'); residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... oo_.exo_simul,M_.params,oo_.steady_state, ... diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m index e20c9faf6..1f55a2de4 100644 --- a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m +++ b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m @@ -123,16 +123,16 @@ if nargout>1 yy = oo_.endo_simul(:,2:options_.periods+1); if ~exist('illi') illi = M_.lead_lag_incidence'; - [i_cols,junk,i_cols_j] = find(illi(:)); + [i_cols,~,i_cols_j] = find(illi(:)); illi = illi(:,2:3); - [i_cols_J1,junk,i_cols_1] = find(illi(:)); + [i_cols_J1,~,i_cols_1] = find(illi(:)); i_cols_T = nonzeros(M_.lead_lag_incidence(1:2,:)'); end if options_.block && ~options_.bytecode maxerror = oo_.deterministic_simulation.error; else if options_.bytecode - [chck, residuals, junk]= bytecode('dynamic','evaluate', oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, 1); + [chck, residuals, ~]= bytecode('dynamic','evaluate', oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, 1); else residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... oo_.exo_simul,M_.params,oo_.steady_state, ... diff --git a/matlab/perfect-foresight-models/private/initialize_stacked_problem.m b/matlab/perfect-foresight-models/private/initialize_stacked_problem.m index 1a8f61838..f019805dc 100644 --- a/matlab/perfect-foresight-models/private/initialize_stacked_problem.m +++ b/matlab/perfect-foresight-models/private/initialize_stacked_problem.m @@ -71,8 +71,8 @@ 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(:)); +[i_cols,~,i_cols_j] = find(illi(:)); illi = illi(:,2:3); -[i_cols_J1, junk,i_cols_1] = find(illi(:)); +[i_cols_J1,~,i_cols_1] = find(illi(:)); i_cols_T = nonzeros(M.lead_lag_incidence(1:2,:)'); dynamicmodel = str2func([M.fname,'.dynamic']); \ No newline at end of file diff --git a/matlab/perfect-foresight-models/private/simulation_core.m b/matlab/perfect-foresight-models/private/simulation_core.m index 61f6693a4..aa66ef2de 100644 --- a/matlab/perfect-foresight-models/private/simulation_core.m +++ b/matlab/perfect-foresight-models/private/simulation_core.m @@ -99,16 +99,16 @@ if nargout>1 yy = oo_.endo_simul(:,2:options_.periods+1); if ~exist('illi') illi = M_.lead_lag_incidence'; - [i_cols,junk,i_cols_j] = find(illi(:)); + [i_cols,~,i_cols_j] = find(illi(:)); illi = illi(:,2:3); - [i_cols_J1,junk,i_cols_1] = find(illi(:)); + [i_cols_J1,~,i_cols_1] = find(illi(:)); i_cols_T = nonzeros(M_.lead_lag_incidence(1:2,:)'); end if options_.block && ~options_.bytecode maxerror = oo_.deterministic_simulation.error; else if options_.bytecode - [chck, residuals, junk]= bytecode('dynamic','evaluate', oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, 1); + [chck, residuals, ~]= bytecode('dynamic','evaluate', oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, 1); else residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... oo_.exo_simul,M_.params,oo_.steady_state, ... diff --git a/matlab/prior_posterior_statistics_core.m b/matlab/prior_posterior_statistics_core.m index 7fa6832d2..320fb272f 100644 --- a/matlab/prior_posterior_statistics_core.m +++ b/matlab/prior_posterior_statistics_core.m @@ -204,7 +204,7 @@ for b=fpar:B if run_smoother [dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); - [alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK,junk1,junk2,P,junk4,junk5,trend_addition,state_uncertainty,M_,oo_,options_,bayestopt_] = ... + [alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK,~,~,P,~,~,trend_addition,state_uncertainty,M_,oo_,options_,bayestopt_] = ... DsgeSmoother(deep,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_); stock_trend_coeff(options_.varobs_id,irun(9))=trend_coeff; diff --git a/matlab/realtime_shock_decomposition.m b/matlab/realtime_shock_decomposition.m index d955b8cb6..02064a7b0 100644 --- a/matlab/realtime_shock_decomposition.m +++ b/matlab/realtime_shock_decomposition.m @@ -98,8 +98,7 @@ nobs = options_.nobs; if forecast_ && any(forecast_params) M1=M_; M1.params = forecast_params; - [junk1,junk2,junk3,junk4,junk5,junk6,oo1] = dynare_resolve(M1,options_,oo_); - clear junk1 junk2 junk3 junk4 junk5 junk6 + [~,~,~,~,~,~,oo1] = dynare_resolve(M1,options_,oo_); end if fast_realtime @@ -109,7 +108,7 @@ if fast_realtime newString=sprintf(running_text); fprintf(['%s'],newString); options_.nobs=fast_realtime; - [oo0,M_,junk1,junk2,Smoothed_Variables_deviation_from_mean0] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); + [oo0,M_,~,~,Smoothed_Variables_deviation_from_mean0] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); gend0 = size(oo0.SmoothedShocks.(M_.exo_names{1}),1); prctdone=0.5; if isoctave @@ -120,7 +119,7 @@ if fast_realtime fprintf([s0,'%s'],newString); end options_.nobs=nobs; - [oo2,M_,junk1,junk2,Smoothed_Variables_deviation_from_mean2] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); + [oo2,M_,~,~,Smoothed_Variables_deviation_from_mean2] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); gend2 = size(oo2.SmoothedShocks.(M_.exo_names{1}),1); prctdone=1; if isoctave @@ -142,7 +141,7 @@ for j=presample+1:nobs % evalin('base',['options_.nobs=' int2str(j) ';']) options_.nobs=j; if ~fast_realtime - [oo,M_,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); + [oo,M_,~,~,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); gend = size(oo.SmoothedShocks.(M_.exo_names{1}),1); else gend = gend0+j-fast_realtime; diff --git a/matlab/shock_decomposition.m b/matlab/shock_decomposition.m index c35bf5e59..02c18a186 100644 --- a/matlab/shock_decomposition.m +++ b/matlab/shock_decomposition.m @@ -72,7 +72,7 @@ end options_.selected_variables_only = 0; %make sure all variables are stored options_.plot_priors=0; -[oo_, M_, junk1, junk2, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set, varlist, M_, oo_, options_, bayestopt_, estim_params_); +[oo_, M_, ~, ~, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set, varlist, M_, oo_, options_, bayestopt_, estim_params_); % reduced form dr = oo_.dr; diff --git a/matlab/simulated_moments_estimation.m b/matlab/simulated_moments_estimation.m index 2d90a9aaa..4a99ec77e 100644 --- a/matlab/simulated_moments_estimation.m +++ b/matlab/simulated_moments_estimation.m @@ -97,7 +97,7 @@ if nargin>2 if ~isunix error('The parallel version of SMM estimation is not implemented for non unix platforms!') end - [junk,hostname] = unix('hostname --fqdn'); + [~,hostname] = unix('hostname --fqdn'); hostname = deblank(hostname); master_is_running_a_job = 0; for i=1:length(parallel) diff --git a/matlab/stochastic_solvers.m b/matlab/stochastic_solvers.m index a3004899a..9f08b1601 100644 --- a/matlab/stochastic_solvers.m +++ b/matlab/stochastic_solvers.m @@ -111,22 +111,22 @@ it_ = M_.maximum_lag + 1; z = repmat(dr.ys,1,klen); if local_order == 1 if (options_.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... - M_.params, dr.ys, 1); + [chck, ~, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... + M_.params, dr.ys, 1); jacobia_ = [loc_dr.g1 loc_dr.g1_x loc_dr.g1_xd]; else - [junk,jacobia_] = feval([M_.fname '.dynamic'],z(iyr0),exo_simul, ... - M_.params, dr.ys, it_); + [~,jacobia_] = feval([M_.fname '.dynamic'],z(iyr0),exo_simul, ... + M_.params, dr.ys, it_); end elseif local_order == 2 if (options_.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... - M_.params, dr.ys, 1); + [chck, ~, loc_dr] = bytecode('dynamic','evaluate', z,exo_simul, ... + M_.params, dr.ys, 1); jacobia_ = [loc_dr.g1 loc_dr.g1_x]; else - [junk,jacobia_,hessian1] = feval([M_.fname '.dynamic'],z(iyr0),... - exo_simul, ... - M_.params, dr.ys, it_); + [~,jacobia_,hessian1] = feval([M_.fname '.dynamic'],z(iyr0),... + exo_simul, ... + M_.params, dr.ys, it_); end if options_.use_dll % In USE_DLL mode, the hessian is in the 3-column sparse representation @@ -217,15 +217,15 @@ nz = nnz(M_.lead_lag_incidence); sdyn = M_.endo_nbr - nstatic; -[junk,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ... - order_var)); +[~,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ... + order_var)); b = zeros(M_.endo_nbr,M_.endo_nbr); b(:,cols_b) = jacobia_(:,cols_j); if M_.maximum_endo_lead == 0 % backward models: simplified code exist only at order == 1 if local_order == 1 - [k1,junk,k2] = find(kstate(:,4)); + [k1,~,k2] = find(kstate(:,4)); dr.ghx(:,k1) = -b\jacobia_(:,k2); if M_.exo_nbr dr.ghu = -b\jacobia_(:,nz+1:end); diff --git a/matlab/store_smoother_results.m b/matlab/store_smoother_results.m index 3688dd13f..bad4fe723 100644 --- a/matlab/store_smoother_results.m +++ b/matlab/store_smoother_results.m @@ -204,7 +204,7 @@ if ~isempty(options_.nk) && options_.nk ~= 0 end else positions_in_declaration_order=oo_.dr.order_var(bayestopt_.smoother_var_list(bayestopt_.smoother_saved_var_list)); - [junk,sorted_index_declaration_order]=sort(positions_in_declaration_order); + [~,sorted_index_declaration_order]=sort(positions_in_declaration_order); oo_.FilteredVariablesKStepAhead(:,sorted_index_declaration_order,:)=oo_.FilteredVariablesKStepAhead; if ~isempty(PK) && options_.filter_covariance %get K-step ahead variances oo_.FilteredVariablesKStepAheadVariances(:,sorted_index_declaration_order,sorted_index_declaration_order,:)=oo_.FilteredVariablesKStepAheadVariances; diff --git a/matlab/user_has_matlab_license.m b/matlab/user_has_matlab_license.m index c8c681283..6f8b3c226 100644 --- a/matlab/user_has_matlab_license.m +++ b/matlab/user_has_matlab_license.m @@ -31,7 +31,7 @@ function [hasLicense] = user_has_matlab_license(toolbox) if matlab_ver_less_than('7.12') hasLicense = license('test', toolbox); else - [hasLicense, junk] = license('checkout',toolbox); + [hasLicense, ~] = license('checkout',toolbox); end if ~hasLicense return diff --git a/matlab/utilities/general/clean_current_folder.m b/matlab/utilities/general/clean_current_folder.m index 6c302927e..df7e7bf79 100644 --- a/matlab/utilities/general/clean_current_folder.m +++ b/matlab/utilities/general/clean_current_folder.m @@ -21,7 +21,7 @@ a = dir('*.mod'); for i = 1:length(a) - [junk,basename,extension] = fileparts(a(i).name); + [~,basename,extension] = fileparts(a(i).name); if exist([basename '.m']) delete([basename '.m']); end diff --git a/matlab/varlist_indices.m b/matlab/varlist_indices.m index 91b2f6e69..a166f28b6 100644 --- a/matlab/varlist_indices.m +++ b/matlab/varlist_indices.m @@ -48,7 +48,7 @@ if ~all(check) end nvar = length(i_var); -[i_var_unique, index_uniques, junk] = unique(i_var, 'first'); +[i_var_unique, index_uniques, ~] = unique(i_var, 'first'); index_uniques = sort(index_uniques); i_var_unique = i_var(index_uniques);