parent
b6a8887da3
commit
5d8d5e90d8
|
@ -7058,7 +7058,10 @@ Specify the parameter set to use for running the smoother. The
|
|||
@var{PARAMETER_SET} can take one of the following seven values:
|
||||
@code{calibration}, @code{prior_mode}, @code{prior_mean},
|
||||
@code{posterior_mode}, @code{posterior_mean},
|
||||
@code{posterior_median}, @code{mle_mode}. Default value: @code{posterior_mean} if
|
||||
@code{posterior_median}, @code{mle_mode}. Note that the parameter
|
||||
set used in subsequent commands like @code{stoch_simul} will be set to
|
||||
the specified @code{parameter_set}.
|
||||
Default value: @code{posterior_mean} if
|
||||
Metropolis has been run, @code{mle_mode} if MLE has been run.
|
||||
|
||||
@item datafile = @var{FILENAME}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function [oo_,options_,bayestopt_,Smoothed_variables_declaration_order_deviation_form]=evaluate_smoother(parameters,var_list,M_,oo_,options_,bayestopt_,estim_params_)
|
||||
function [oo_,M_,options_,bayestopt_,Smoothed_variables_declaration_order_deviation_form]=evaluate_smoother(parameters,var_list,M_,oo_,options_,bayestopt_,estim_params_)
|
||||
% Evaluate the smoother at parameters.
|
||||
%
|
||||
% INPUTS
|
||||
|
@ -21,13 +21,14 @@ function [oo_,options_,bayestopt_,Smoothed_variables_declaration_order_deviation
|
|||
% - SmoothedMeasurementErrors
|
||||
% - FilteredVariablesKStepAhead
|
||||
% - FilteredVariablesKStepAheadVariances
|
||||
% o M_ [structure] Definition of the model
|
||||
% o options_ [structure] Options; returns options_.first_obs
|
||||
% o bayestopt_ [structure] describing the priors; returns fields like bayestopt_.smoother_var_list from the smoother
|
||||
% o Smoothed_variables_declaration_order_deviation_form
|
||||
% Smoothed variables from the Kalman smoother in
|
||||
% order of declaration of variables (M_.endo_names)
|
||||
% in deviations from their respective mean, i.e.
|
||||
% without trend and constant part (used for shock_decomposition)
|
||||
% o options_ [structure] Options; returns options_.first_obs
|
||||
% o bayestopt_ [structure] describing the priors; returns fields like bayestopt_.smoother_var_list from the smoother
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function oo_ = shock_decomposition(M_,oo_,options_,varlist,bayestopt_,estim_params_)
|
||||
function [oo_,M_] = shock_decomposition(M_,oo_,options_,varlist,bayestopt_,estim_params_)
|
||||
% function z = shock_decomposition(M_,oo_,options_,varlist)
|
||||
% Computes shocks contribution to a simulated trajectory. The field set is
|
||||
% oo_.shock_decomposition. It is a n_var by nshock+2 by nperiods array. The
|
||||
|
@ -17,6 +17,8 @@ function oo_ = shock_decomposition(M_,oo_,options_,varlist,bayestopt_,estim_para
|
|||
%
|
||||
% OUTPUTS
|
||||
% oo_: [structure] Storage of results
|
||||
% M_: [structure] Definition of the model; makes sure that
|
||||
% M_.params is correctly updated
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -69,10 +71,10 @@ end
|
|||
|
||||
options_.selected_variables_only = 0; %make sure all variables are stored
|
||||
options_.plot_priors=0;
|
||||
[oo,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_);
|
||||
[oo_, M_, junk1, junk2, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set, varlist, M_, oo_, options_, bayestopt_, estim_params_);
|
||||
|
||||
% reduced form
|
||||
dr = oo.dr;
|
||||
dr = oo_.dr;
|
||||
|
||||
% data reordering
|
||||
order_var = dr.order_var;
|
||||
|
@ -84,10 +86,10 @@ A = dr.ghx;
|
|||
B = dr.ghu;
|
||||
|
||||
% initialization
|
||||
gend = size(oo.SmoothedShocks.(deblank(M_.exo_names(1,:))),1);
|
||||
gend = size(oo_.SmoothedShocks.(deblank(M_.exo_names(1,:))),1);
|
||||
epsilon=NaN(nshocks,gend);
|
||||
for i=1:nshocks
|
||||
epsilon(i,:) = oo.SmoothedShocks.(deblank(M_.exo_names(i,:)));
|
||||
epsilon(i,:) = oo_.SmoothedShocks.(deblank(M_.exo_names(i,:)));
|
||||
end
|
||||
|
||||
z = zeros(endo_nbr,nshocks+2,gend);
|
||||
|
@ -95,7 +97,6 @@ z = zeros(endo_nbr,nshocks+2,gend);
|
|||
z(:,end,:) = Smoothed_Variables_deviation_from_mean;
|
||||
|
||||
maximum_lag = M_.maximum_lag;
|
||||
lead_lag_incidence = M_.lead_lag_incidence;
|
||||
|
||||
k2 = dr.kstate(find(dr.kstate(:,2) <= maximum_lag+1),[1 2]);
|
||||
i_state = order_var(k2(:,1))+(min(i,maximum_lag)+1-k2(:,2))*M_.endo_nbr;
|
||||
|
@ -118,9 +119,8 @@ for i=1:gend
|
|||
z(:,nshocks+1,i) = z(:,nshocks+2,i) - sum(z(:,1:nshocks,i),2);
|
||||
end
|
||||
|
||||
|
||||
oo_.shock_decomposition = z;
|
||||
|
||||
|
||||
if ~options_.no_graph.shock_decomposition
|
||||
plot_shock_decomposition(M_,oo_,options_,varlist);
|
||||
end
|
|
@ -1662,7 +1662,7 @@ ShockDecompositionStatement::writeOutput(ostream &output, const string &basename
|
|||
{
|
||||
options_list.writeOutput(output);
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "oo_ = shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);" << endl;
|
||||
output << "[oo_,M_]= shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);" << endl;
|
||||
}
|
||||
|
||||
ConditionalForecastStatement::ConditionalForecastStatement(const OptionsList &options_list_arg) :
|
||||
|
@ -3191,7 +3191,7 @@ CalibSmootherStatement::writeOutput(ostream &output, const string &basename, boo
|
|||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "options_.smoother = 1;" << endl;
|
||||
output << "options_.order = 1;" << endl;
|
||||
output << "[oo_,options_,bayestopt_]=evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl;
|
||||
output << "[oo_,M_,options_,bayestopt_]=evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl;
|
||||
}
|
||||
|
||||
ExtendedPathStatement::ExtendedPathStatement(const OptionsList &options_list_arg)
|
||||
|
|
Loading…
Reference in New Issue