@@ -231,14 +231,14 @@ if info(1) == 0 %no errors in solution
end
ind_dDYNAMIC=(find(max(abs(dDYNAMIC'),[],1)>tol_deriv));%index with non-zero rows
end
DYNAMIC=DYNAMIC(ind_dDYNAMIC);%focus only on non-zero entries
si_dDYNAMIC=(dDYNAMIC(ind_dDYNAMIC,:));%focus only on non-zero rows
if~no_identification_reducedform
REDUCEDFORM=REDUCEDFORM(ind_dREDUCEDFORM);%focus only on non-zero entries
si_dREDUCEDFORM=(dREDUCEDFORM(ind_dREDUCEDFORM,:));%focus only on non-zero rows
end
if~no_identification_moments
MOMENTS=MOMENTS(ind_dMOMENTS);%focus only on non-zero entries
si_dMOMENTS=(dMOMENTS(ind_dMOMENTS,:));%focus only on non-zero derivatives
...
...
@@ -268,6 +268,9 @@ if info(1) == 0 %no errors in solution
try
%try to compute asymptotic Hessian for identification strength analysis based on moments
ifoptions_.order>1
error('IDENTIFICATION STRENGTH: Analytic computation of Hessian is not available for ''order>1''. Identification strength is based on simulated moment uncertainty');
end
% reset some options for faster computations
options_.irf=0;
options_.noprint=1;
...
...
@@ -282,10 +285,6 @@ if info(1) == 0 %no errors in solution
dataset_=dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'),options_.varobs);%get information on moments
derivatives_info.no_DLIK=1;
bounds=prior_bounds(bayestopt_,options_.prior_trunc);%reset bounds as lb and ub must only be operational during mode-finding
ifoptions_.order>1
fprintf('IDENTIFICATION STRENGTH: Analytic computation of Hessian is not available for ''order>1''\n')
fprintf(' Identification strength is based on simulated moment uncertainty\n');
end
%note that for order>1 we do not provide any information on DT,DYss,DOM in derivatives_info, such that dsge_likelihood creates an error. Therefore the computation will be based on simulated_moment_uncertainty for order>1.
[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);%non-used output variables need to be set for octave for some reason
%note that for the order of parameters in AHess we have: stderr parameters come first, corr parameters second, model parameters third. the order within these blocks corresponds to the order specified in the estimated_params block
...
...
@@ -315,6 +314,13 @@ if info(1) == 0 %no errors in solution
flag_score=1;%this is used for the title in plot_identification.m
catch
%Asymptotic Hessian via simulation
ifoptions_.order>1
% reset some options for faster computations
options_.irf=0;
options_.noprint=1;
options_.SpectralDensity.trigger=0;
options_.periods=periods+100;
end
replic=max([replic,length(ind_dMOMENTS)*3]);
cmm=simulated_moment_uncertainty(ind_dMOMENTS,periods,replic,options_,M_,oo_);%covariance matrix of moments
@@ -324,35 +368,55 @@ for j=2:min(length(indtotparam),max_dim_subsets_groups) % Check j-element subset
k_dDYNAMIC=k_dDYNAMIC+1;
ifk_dDYNAMIC<=size(indexj_dDYNAMIC,1)
dDYNAMIC_j=dDYNAMIC(:,indexj_dDYNAMIC(k_dDYNAMIC,:));% pick columns that correspond to parameter subset
rankj_dDYNAMIC(k_dDYNAMIC,1)=rank(full(dDYNAMIC_j),tol_rank);%compute rank with imposed tolerance
ifstrcmp(tol_rank,'robust')
rankj_dDYNAMIC(k_dDYNAMIC,1)=rank(full(dDYNAMIC_j));%compute rank with imposed tolerance
else
rankj_dDYNAMIC(k_dDYNAMIC,1)=rank(full(dDYNAMIC_j),tol_rank);%compute rank with imposed tolerance
end
end
end
if~no_identification_reducedform
k_dREDUCEDFORM=k_dREDUCEDFORM+1;
ifk_dREDUCEDFORM<=size(indexj_dREDUCEDFORM,1)
dREDUCEDFORM_j=dREDUCEDFORM(:,indexj_dREDUCEDFORM(k_dREDUCEDFORM,:));% pick columns that correspond to parameter subset
rankj_dREDUCEDFORM(k_dREDUCEDFORM,1)=rank(full(dREDUCEDFORM_j),tol_rank);%compute rank with imposed tolerance
ifstrcmp(tol_rank,'robust')
rankj_dREDUCEDFORM(k_dREDUCEDFORM,1)=rank(full(dREDUCEDFORM_j));%compute rank with imposed tolerance
else
rankj_dREDUCEDFORM(k_dREDUCEDFORM,1)=rank(full(dREDUCEDFORM_j),tol_rank);%compute rank with imposed tolerance
end
end
end
if~no_identification_moments
k_dMOMENTS=k_dMOMENTS+1;
ifk_dMOMENTS<=size(indexj_dMOMENTS,1)
dMOMENTS_j=dMOMENTS(:,indexj_dMOMENTS(k_dMOMENTS,:));% pick columns that correspond to parameter subset
rankj_dMOMENTS(k_dMOMENTS,1)=rank(full(dMOMENTS_j),tol_rank);%compute rank with imposed tolerance
ifstrcmp(tol_rank,'robust')
rankj_dMOMENTS(k_dMOMENTS,1)=rank(full(dMOMENTS_j));%compute rank with imposed tolerance
else
rankj_dMOMENTS(k_dMOMENTS,1)=rank(full(dMOMENTS_j),tol_rank);%compute rank with imposed tolerance
end
end
end
if~no_identification_minimal
k_dMINIMAL=k_dMINIMAL+1;
ifk_dMINIMAL<=size(indexj_dMINIMAL,1)
dMINIMAL_j=[dMINIMAL_par(:,indexj_dMINIMAL(k_dMINIMAL,:))dMINIMAL_rest];% pick columns in dMINIMAL_par that correspond to parameter subset and augment with parameter-indepdendet part dMINIMAL_rest
rankj_dMINIMAL(k_dMINIMAL,1)=rank(full(dMINIMAL_j),tol_rank);%compute rank with imposed tolerance
ifstrcmp(tol_rank,'robust')
rankj_dMINIMAL(k_dMINIMAL,1)=rank(full(dMINIMAL_j));%compute rank with imposed tolerance
else
rankj_dMINIMAL(k_dMINIMAL,1)=rank(full(dMINIMAL_j),tol_rank);%compute rank with imposed tolerance
end
end
end
if~no_identification_spectrum
k_dSPECTRUM=k_dSPECTRUM+1;
ifk_dSPECTRUM<=size(indexj_dSPECTRUM,1)
dSPECTRUM_j=dSPECTRUM(indexj_dSPECTRUM(k_dSPECTRUM,:),indexj_dSPECTRUM(k_dSPECTRUM,:));% pick rows and columns that correspond to parameter subset
rankj_dSPECTRUM(k_dSPECTRUM,1)=rank(full(dSPECTRUM_j),tol_rank);% Compute rank with imposed tol
ifstrcmp(tol_rank,'robust')
rankj_dSPECTRUM(k_dSPECTRUM,1)=rank(full(dSPECTRUM_j));% Compute rank with imposed tol
else
rankj_dSPECTRUM(k_dSPECTRUM,1)=rank(full(dSPECTRUM_j),tol_rank);% Compute rank with imposed tol