bug fixes and examples in testsuite
parent
0c4b59b19e
commit
281f01f29e
|
@ -56,7 +56,7 @@ if opts.replic
|
|||
options_.occbin.simul.exo_pos=ishock;
|
||||
options_.occbin.simul.SHOCKS = SHOCKS;
|
||||
options_.occbin.simul.waitbar=0;
|
||||
[~, out] = occbin.solver(M_,oo_,options_);
|
||||
[~, out] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
zlin0(:,:,iter)=out.linear;
|
||||
zpiece0(:,:,iter)=out.piecewise;
|
||||
ys=out.ys;
|
||||
|
@ -124,7 +124,8 @@ else
|
|||
options_.occbin.simul.init_violvecbool = [];
|
||||
options_.occbin.simul.irfshock = M_.exo_names;
|
||||
options_.occbin.simul.SHOCKS = SHOCKS;
|
||||
[~, out] = occbin.solver(M_,oo_,options_);
|
||||
[~, out] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
|
||||
zlin=out.linear;
|
||||
zpiece=out.piecewise;
|
||||
frcst_regime_history=out.regime_history;
|
||||
|
|
|
@ -20,7 +20,7 @@ else
|
|||
options_.occbin.simul.endo_init = oo_.occbin.smoother.alphahat(oo_.dr.inv_order_var,t0);
|
||||
end
|
||||
options_.occbin.simul.SHOCKS=shocks0;
|
||||
[~, out0] = occbin.solver(M_,oo_,options_);
|
||||
[~, out0] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
zlin0 = out0.linear;
|
||||
zpiece0 = out0.piecewise;
|
||||
|
||||
|
@ -61,11 +61,11 @@ for counter = 1:length(jexo_all)
|
|||
if t0 == 0
|
||||
options_.occbin.simul.SHOCKS=shocks1;
|
||||
options_.occbin.simul.endo_init = [];
|
||||
[~, out_pos] = occbin.solver(M_,oo_,options_);
|
||||
[~, out_pos] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
else
|
||||
options_.occbin.simul.SHOCKS=shocks1;
|
||||
options_.occbin.simul.endo_init = oo_.occbin.smoother.alphahat(oo_.dr.inv_order_var,t0);
|
||||
[~, out_pos] = occbin.solver(M_,oo_,options_);
|
||||
[~, out_pos] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
end
|
||||
if out_pos.error_flag
|
||||
warning('Occbin error.')
|
||||
|
@ -85,11 +85,11 @@ for counter = 1:length(jexo_all)
|
|||
if t0 == 0
|
||||
options_.occbin.simul.SHOCKS=shocks_1;
|
||||
options_.occbin.simul.endo_init = [];
|
||||
[~, out_neg] = occbin.solver(M_,oo_,options_);
|
||||
[~, out_neg] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
else
|
||||
options_.occbin.simul.SHOCKS=shocks_1;
|
||||
options_.occbin.simul.endo_init = oo_.occbin.smoother.alphahat(oo_.dr.inv_order_var,t0);
|
||||
[~, out_neg] = occbin.solver(M_,oo_,options_);
|
||||
[~, out_neg] = occbin.solver(M_,options_,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);
|
||||
end
|
||||
if out_neg.error_flag
|
||||
warning('Occbin error.')
|
||||
|
|
|
@ -66,7 +66,7 @@ for sss = 1:numel(shocksigns)
|
|||
j1=j1+1;
|
||||
if mod(j1,npan)==1
|
||||
% vector corresponds to [left bottom width height]. 680 and 678 for the left and bottom elements correspond to the default values used by MATLAB while creating a figure and width, .
|
||||
hfig = dyn_figure(options_.nodisplay,'name',['OccbinIRFs ' shocknames{j} ' ' simulname],'PaperPositionMode', 'auto','PaperType','A4','PaperOrientation','portrait','renderermode','auto','position',[10 10 950 650]);
|
||||
hfig = dyn_figure(options_.nodisplay,'name',['OccbinIRFs ' shocknames{j} ' ' simulname ' ' shocksign],'PaperPositionMode', 'auto','PaperType','A4','PaperOrientation','portrait','renderermode','auto','position',[10 10 950 650]);
|
||||
ifig=ifig+1;
|
||||
isub=0;
|
||||
end
|
||||
|
|
|
@ -311,6 +311,41 @@ varobs yg inom pi;
|
|||
mh_replic=0, plot_priors=0, smoother,
|
||||
nodisplay,consider_all_endogenous,heteroskedastic_filter,filter_step_ahead=[1],smoothed_state_uncertainty);
|
||||
|
||||
// plot regimes
|
||||
occbin.plot_regimes(oo_.occbin.smoother.regime_history,M_,options_)
|
||||
|
||||
// forecast starting from period 42, zero shocks (default)
|
||||
smoother2histval(period=42);
|
||||
[oo, error_flag] = occbin.forecast(options_,M_,oo_,8);
|
||||
// forecast with stochastic shocks
|
||||
options_.occbin.forecast.qmc=true;
|
||||
options_.occbin.forecast.replic=127;
|
||||
[oo1, error_flag] = occbin.forecast(options_,M_,oo_,8);
|
||||
|
||||
// GIRF given states in 42 and shocks in 43
|
||||
t0=42;
|
||||
options_.occbin.irf.exo_names=M_.exo_names;
|
||||
options_.occbin.irf.t0=t0;
|
||||
oo_ = occbin.irf(M_,oo_,options_);
|
||||
|
||||
vars_irf = {
|
||||
'c', 'consumption'
|
||||
'n', 'labor'
|
||||
'y', 'output'
|
||||
'pigap', 'inflation rate'
|
||||
'inom', 'interest rate'
|
||||
'inomnot', 'shadow rate'
|
||||
};
|
||||
|
||||
options_.occbin.plot_irf.exo_names = M_.exo_names;
|
||||
options_.occbin.plot_irf.endo_names = vars_irf(:,1);
|
||||
options_.occbin.plot_irf.endo_names_long = vars_irf(:,2);
|
||||
// if you want to scale ...
|
||||
// options_occbin_.plot_irf.endo_scaling_factor = vars_irf(:,3);
|
||||
options_.occbin.plot_irf.simulname = ['t0_' int2str(t0)];
|
||||
options_.occbin.plot_irf.tplot = min(40,options_.irf);
|
||||
occbin.plot_irfs(M_,oo_,options_);
|
||||
|
||||
oo0=oo_;
|
||||
// use smoother_redux
|
||||
estimation(
|
||||
|
|
|
@ -109,5 +109,7 @@ occbin_graph(noconstant) c erra lambdak k i a k;
|
|||
line1=100*[oo_.occbin.endo_piecewise.c-oo_.occbin.endo_ss.c,oo_.occbin.endo_piecewise.lambdak/100,oo_.occbin.endo_piecewise.k-oo_.occbin.endo_ss.k,oo_.occbin.endo_piecewise.i-oo_.occbin.endo_ss.i,oo_.occbin.endo_piecewise.a-oo_.occbin.endo_ss.a, shock_vector];
|
||||
line2=100*[oo_.occbin.linear_smoother.SmoothedVariables.c-oo_.occbin.endo_ss.c,oo_.occbin.linear_smoother.SmoothedVariables.lambdak/100,oo_.occbin.linear_smoother.SmoothedVariables.k-oo_.occbin.endo_ss.k,oo_.occbin.linear_smoother.SmoothedVariables.i-oo_.occbin.endo_ss.i,oo_.occbin.linear_smoother.SmoothedVariables.a-oo_.occbin.endo_ss.a, oo_.occbin.linear_smoother.SmoothedShocks.erra/100];
|
||||
occbin.make_chart(titlelist,legendlist,figtitle,ylabels,cat(3,line1,line2));
|
||||
|
||||
occbin.plot_regimes(oo_.occbin.smoother.regime_history,M_,options_)
|
||||
@#endif
|
||||
@#endfor
|
||||
|
|
Loading…
Reference in New Issue