clean up file (remove unused variables, fprintf instead of disp(sprintf()))

time-shift
Houtan Bastani 2019-09-11 11:14:20 +02:00
parent f118970736
commit 42842a5afc
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
5 changed files with 14 additions and 24 deletions

View File

@ -23,7 +23,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,B,whoiam, ThisMatlab)
% SPECIAL REQUIREMENTS. % SPECIAL REQUIREMENTS.
% None. % None.
% %
% Copyright (C) 2006-2018 Dynare Team % Copyright (C) 2006-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -70,10 +70,8 @@ NumberOfIRFfiles_dsgevar=myinputs.NumberOfIRFfiles_dsgevar;
ifil2=myinputs.ifil2; ifil2=myinputs.ifil2;
if options_.dsge_var if options_.dsge_var
gend=myinputs.gend;
nvobs=myinputs.nvobs; nvobs=myinputs.nvobs;
NumberOfParametersPerEquation = myinputs.NumberOfParametersPerEquation; NumberOfParametersPerEquation = myinputs.NumberOfParametersPerEquation;
NumberOfLags = myinputs.NumberOfLags;
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs; NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
Companion_matrix = myinputs.Companion_matrix; Companion_matrix = myinputs.Companion_matrix;
stock_irf_bvardsge = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar); stock_irf_bvardsge = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
@ -194,7 +192,7 @@ while fpar<B
end end
if MAX_nirfs_dsgevar if MAX_nirfs_dsgevar
IRUN = IRUN+1; IRUN = IRUN+1;
[fval,info,~,~,~,~,~,PHI,SIGMAu,iXX] = dsge_var_likelihood(deep',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_); [~,~,~,~,~,~,~,PHI,SIGMAu,iXX] = dsge_var_likelihood(deep',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
dsge_prior_weight = M_.params(strmatch('dsge_prior_weight', M_.param_names)); dsge_prior_weight = M_.params(strmatch('dsge_prior_weight', M_.param_names));
DSGE_PRIOR_WEIGHT = floor(dataset_.nobs*(1+dsge_prior_weight)); DSGE_PRIOR_WEIGHT = floor(dataset_.nobs*(1+dsge_prior_weight));
SIGMA_inv_upper_chol = chol(inv(SIGMAu*dataset_.nobs*(dsge_prior_weight+1))); SIGMA_inv_upper_chol = chol(inv(SIGMAu*dataset_.nobs*(dsge_prior_weight+1)));
@ -216,7 +214,7 @@ while fpar<B
if dsge_prior_weight > 0 if dsge_prior_weight > 0
Atheta(oo_.dr.order_var,M_.exo_names_orig_ord) = oo_.dr.ghu*sqrt(M_.Sigma_e); Atheta(oo_.dr.order_var,M_.exo_names_orig_ord) = oo_.dr.ghu*sqrt(M_.Sigma_e);
A0 = Atheta(bayestopt_.mfys,:); A0 = Atheta(bayestopt_.mfys,:);
[OMEGAstar,SIGMAtr] = qr2(A0'); OMEGAstar = qr2(A0');
end end
SIGMAu_chol = chol(SIGMAu_draw)'; SIGMAu_chol = chol(SIGMAu_draw)';
SIGMAtrOMEGA = SIGMAu_chol*OMEGAstar'; SIGMAtrOMEGA = SIGMAu_chol*OMEGAstar';
@ -245,7 +243,6 @@ while fpar<B
end end
NumberOfIRFfiles_dsgevar = NumberOfIRFfiles_dsgevar+1; NumberOfIRFfiles_dsgevar = NumberOfIRFfiles_dsgevar+1;
IRUN =0; IRUN =0;
stock_irf_dsgevar = zeros(options_.irf,dataset_.vobs,M_.exo_nbr,MAX_nirfs_dsgevar);
end end
end end
if irun == MAX_nirfs_dsge || irun == B || fpar == B if irun == MAX_nirfs_dsge || irun == B || fpar == B

View File

@ -28,12 +28,11 @@ if ~options_.noprint
disp_steady_state(M_,oo_) disp_steady_state(M_,oo_)
for i=M_.orig_endo_nbr:M_.endo_nbr for i=M_.orig_endo_nbr:M_.endo_nbr
if strmatch('mult_', M_.endo_names{i}) if strmatch('mult_', M_.endo_names{i})
disp(sprintf('%s \t\t %g', M_.endo_names{i}, oo_.dr.ys(i))); fprintf('%s \t\t %g\n', M_.endo_names{i}, oo_.dr.ys(i));
end end
end end
end end
oo_.planner_objective_value = evaluate_planner_objective(M_,options_,oo_); oo_.planner_objective_value = evaluate_planner_objective(M_,options_,oo_);
options_ = oldoptions; options_ = oldoptions;

View File

@ -15,7 +15,7 @@ function [g,grad,hess,flag] = moment_function(xparams,sample_moments,dataset,opt
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% The user has to provide a file where the moment conditions are defined. % The user has to provide a file where the moment conditions are defined.
% Copyright (C) 2010-2017 Dynare Team % Copyright (C) 2010-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -92,7 +92,7 @@ else% parallel mode.
error('The parallel version of SMM estimation is not implemented for non unix platforms!') error('The parallel version of SMM estimation is not implemented for non unix platforms!')
end end
job_number = 1;% Remark. First job is for the master. job_number = 1;% Remark. First job is for the master.
[Junk,hostname] = unix('hostname --fqdn'); [~,hostname] = unix('hostname --fqdn');
hostname = deblank(hostname); hostname = deblank(hostname);
for i=1:length(parallel) for i=1:length(parallel)
machine = deblank(parallel(i).machine); machine = deblank(parallel(i).machine);

View File

@ -16,7 +16,7 @@ function osr_res = osr1(i_params,i_var,weights)
% Uses Newton-type optimizer csminwel to directly solve quadratic % Uses Newton-type optimizer csminwel to directly solve quadratic
% osr-problem % osr-problem
% %
% Copyright (C) 2005-2018 Dynare Team % Copyright (C) 2005-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -35,10 +35,6 @@ function osr_res = osr1(i_params,i_var,weights)
global M_ oo_ options_ it_ global M_ oo_ options_ it_
klen = M_.maximum_lag + M_.maximum_lead + 1;
iyv = M_.lead_lag_incidence';
iyv = iyv(:);
iyr0 = find(iyv) ;
it_ = M_.maximum_lag + 1 ; it_ = M_.maximum_lag + 1 ;
osr_res.error_indicator = 1; %initialize indicator osr_res.error_indicator = 1; %initialize indicator
@ -84,8 +80,6 @@ if isfield(options_.osr,'maxit') || isfield(options_.osr,'tolf')
end end
end end
exe =zeros(M_.exo_nbr,1);
oo_.dr = set_state_space(oo_.dr,M_,options_); oo_.dr = set_state_space(oo_.dr,M_,options_);
@ -99,7 +93,7 @@ inv_order_var = oo_.dr.inv_order_var;
%extract unique entries of covariance %extract unique entries of covariance
i_var=unique(i_var); i_var=unique(i_var);
%% do initial checks %% do initial checks
[loss,info,exit_flag,vx]=osr_obj(t0,i_params,inv_order_var(i_var),weights(i_var,i_var)); [loss,info]=osr_obj(t0,i_params,inv_order_var(i_var),weights(i_var,i_var));
if info~=0 if info~=0
print_info(info, options_.noprint, options_); print_info(info, options_.noprint, options_);
else else
@ -129,7 +123,7 @@ else
error('OSR: OSR with bounds on parameters requires a constrained optimizer, i.e. opt_algo= 1,2,5, or 9.') error('OSR: OSR with bounds on parameters requires a constrained optimizer, i.e. opt_algo= 1,2,5, or 9.')
end end
%%do actual optimization %%do actual optimization
[p, f, exitflag] = dynare_minimize_objective(str2func('osr_obj'),t0,options_.osr.opt_algo,options_,M_.osr.param_bounds,M_.param_names(i_params),[],[], i_params,... [p, f] = dynare_minimize_objective(str2func('osr_obj'),t0,options_.osr.opt_algo,options_,M_.osr.param_bounds,M_.param_names(i_params),[],[], i_params,...
inv_order_var(i_var),weights(i_var,i_var)); inv_order_var(i_var),weights(i_var,i_var));
end end
@ -144,9 +138,9 @@ if ~options_.noprint
disp('OPTIMAL VALUE OF THE PARAMETERS:') disp('OPTIMAL VALUE OF THE PARAMETERS:')
skipline() skipline()
for i=1:np for i=1:np
disp(sprintf('%16s %16.6g\n', M_.param_names{i_params(i)}, p(i))) fprintf('%16s %16.6g\n\n', M_.param_names{i_params(i)}, p(i));
end end
disp(sprintf('Objective function : %16.6g\n',f)); fprintf('Objective function : %16.6g\n\n',f);
skipline() skipline()
end end
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); [oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

View File

@ -15,7 +15,7 @@ function [r,flag] = smm_objective(xparams,sample_moments,weighting_matrix,option
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% The user has to provide a file where the moment conditions are defined. % The user has to provide a file where the moment conditions are defined.
% Copyright (C) 2010-2017 Dynare Team % Copyright (C) 2010-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
@ -75,7 +75,7 @@ save('estimated_parameters.mat','xparams');
% Check for local determinacy of the deterministic steady state. % Check for local determinacy of the deterministic steady state.
noprint = options_.noprint; options_.noprint = 1; noprint = options_.noprint; options_.noprint = 1;
[eigval,local_determinacy_and_stability,info] = check(M_,options_,oo_); options_.noprint = noprint; [~,local_determinacy_and_stability,info] = check(M_,options_,oo_); options_.noprint = noprint;
if ~local_determinacy_and_stability if ~local_determinacy_and_stability
r = priorObjectiveValue * (1+info(2)); r = priorObjectiveValue * (1+info(2));
flag = 0; flag = 0;
@ -100,7 +100,7 @@ else% parallel mode.
error('The parallel version of SMM estimation is not implemented for non unix platforms!') error('The parallel version of SMM estimation is not implemented for non unix platforms!')
end end
job_number = 1;% Remark. First job is for the master. job_number = 1;% Remark. First job is for the master.
[Junk,hostname] = unix('hostname --fqdn'); [~,hostname] = unix('hostname --fqdn');
hostname = deblank(hostname); hostname = deblank(hostname);
for i=1:length(parallel) for i=1:length(parallel)
machine = deblank(parallel(i).machine); machine = deblank(parallel(i).machine);