Fix trace plots with measurement errors and their correlations

Problem was introduced when transitioning to cell arrays
time-shift
Johannes Pfeifer 2020-07-15 14:34:04 +02:00
parent acdca03e43
commit f717712ed6
3 changed files with 8 additions and 7 deletions

View File

@ -87,7 +87,7 @@ end
if strcmpi(type,'MeasurementError')
if nargin<6% Covariance matrix diagonal term
i = nvx + strmatch(name1, M_.endo_names{estim_params_.var_endo(:,1)}, 'exact');
i = nvx + strmatch(name1, M_.endo_names(estim_params_.var_endo(:,1)), 'exact');
if isempty(i)
disp(['The standard deviation of the measurement error on ' name1 ' is not an estimated parameter!'])
return
@ -95,7 +95,7 @@ if strcmpi(type,'MeasurementError')
else% Covariance matrix off-diagonal term
offset = nvx+nvn+ncx;
try
list_of_measurement_errors = { M_.endo_names{estim_params_.corrn(:,1)} , M_.endo_names{estim_params_.corrn(:,2)} };
list_of_measurement_errors = [M_.endo_names(estim_params_.corrn(:,1),1) , M_.endo_names(estim_params_.corrn(:,2),1)];
k1 = strmatch(name1,list_of_measurement_errors(:,1),'exact');
k2 = strmatch(name2,list_of_measurement_errors(:,2),'exact');
i = offset+intersect(k1,k2);

View File

@ -133,9 +133,7 @@ if ncn
bayestopt_.p4 = [ bayestopt_.p4; estim_params_.corrn(:,10)]; %take generalized distribution into account
bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.corrn(:,11)];
baseid = length(bayestopt_.name);
bayestopt_.name = [bayestopt_.name; cell(ncn, 1)]; [bayestopt_.name; cellstr([repmat('corr ',ncn,1) ...
M_.endo_names{estim_params_.corrn(:,1)} ...
repmat(', ',ncn,1) , M_.endo_names{estim_params_.corrn(:,2)}])];
bayestopt_.name = [bayestopt_.name; cell(ncn, 1)];;
for i=1:ncn
k1 = estim_params_.corrn(i,1);
k2 = estim_params_.corrn(i,2);

View File

@ -61,7 +61,10 @@ stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
stderr dq,inv_gamma_pdf,0.001,0.0001;
stderr de,inv_gamma_pdf,0.001,0.0001;
stderr pie_obs,inv_gamma_pdf,0.001,0.0001;
corr dq,de, normal_pdf,0,1;
corr pie_obs,de, normal_pdf,0,1;
end;
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=10,prefilter=1,mh_jscale=0.5,mh_replic=0,mode_check);
estimation(datafile=data_ca1,first_obs=8,nobs=79,mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=3000,mode_check);
generate_trace_plots(1);