Merge branch 'occbin_smoother' into 'master'
OccBin Smoother: do not write non-converged results to oo_ Closes #1863 See merge request Dynare/dynare!2100unit-tests
commit
3184db12f2
|
@ -255,7 +255,7 @@ while is_changed && maxiter>iter && ~is_periodic
|
|||
err_TT(iter-1) = max(max(max(abs(TT-sto_TT))));
|
||||
end
|
||||
|
||||
if occbin_smoother_debug
|
||||
if occbin_smoother_debug || is_periodic
|
||||
regime_ = cell(0);
|
||||
regime_new = regime_;
|
||||
start_ = regime_;
|
||||
|
@ -337,14 +337,22 @@ save('info1','regime_history0')
|
|||
end
|
||||
|
||||
if (maxiter==iter && is_changed) || is_periodic
|
||||
disp(['Occbin smoother did not converge.'])
|
||||
disp('occbin.DSGE_smoother: smoother did not converge.')
|
||||
fprintf('occbin.DSGE_smoother: The algorithm did not reach a fixed point for the smoothed regimes.\n')
|
||||
if is_periodic
|
||||
disp(['Occbin smoother algo loops between two solutions.'])
|
||||
oo_.occbin.smoother.error_flag=0;
|
||||
fprintf('occbin.DSGE_smoother: For the periods indicated above, regimes loops between the "regime_" and the "regime_new_" pattern displayed above.\n')
|
||||
fprintf('occbin.DSGE_smoother: We provide smoothed shocks consistent with "regime_" in oo_.\n')
|
||||
else
|
||||
fprintf('occbin.DSGE_smoother: The respective fields in oo_ will be left empty.\n')
|
||||
oo_.occbin.smoother=[];
|
||||
oo_.occbin.smoother.error_flag=1;
|
||||
end
|
||||
else
|
||||
disp(['Occbin smoother converged.'])
|
||||
disp('occbin.DSGE_smoother: smoother converged.')
|
||||
oo_.occbin.smoother.error_flag=0;
|
||||
if occbin_smoother_fast && is_changed_start
|
||||
disp('WARNING: fast algo is used, regime(s) duration(s) was not forced to converge')
|
||||
disp('occbin.DSGE_smoother: WARNING: fast algo is used, regime duration was not forced to converge')
|
||||
end
|
||||
end
|
||||
if (~is_changed || occbin_smoother_debug) && nargin==12
|
||||
|
|
|
@ -185,11 +185,14 @@ if isequal(options_.mode_compute,0) && isempty(options_.mode_file) && ~options_.
|
|||
else
|
||||
if options_.occbin.smoother.status
|
||||
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_] = occbin.DSGE_smoother(xparam1,gend,transpose(data),data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_,dataset_,dataset_info);
|
||||
if oo_.occbin.smoother.error_flag==0
|
||||
[oo_]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
else
|
||||
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_] = DsgeSmoother(xparam1,gend,transpose(data),data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
end
|
||||
[oo_]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
end
|
||||
if options_.forecast > 0
|
||||
oo_.forecast = dyn_forecast(var_list_,M_,options_,oo_,'smoother',dataset_info);
|
||||
end
|
||||
|
@ -600,8 +603,12 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
else
|
||||
if options_.occbin.smoother.status
|
||||
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_] = occbin.DSGE_smoother(xparam1,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state,M_,oo_,options_,bayestopt_,estim_params_,dataset_,dataset_info);
|
||||
if oo_.occbin.smoother.error_flag==0
|
||||
[oo_,yf]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
else
|
||||
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_] = DsgeSmoother(xparam1,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
[oo_,yf]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
[oo_,yf]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
|
|
|
@ -120,7 +120,9 @@ else
|
|||
DsgeSmoother(parameters,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
end
|
||||
if ~(options_.occbin.smoother.status && options_.occbin.smoother.inversion_filter)
|
||||
if ~options_.occbin.smoother.status || (options_.occbin.smoother.status && oo_.occbin.smoother.error_flag==0)
|
||||
[oo_]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty);
|
||||
end
|
||||
else
|
||||
[oo_]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff);
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue