Make shock_decomposition.m rely on smoothed deviations from mean
Necessary after adding trend and mean to smoothed variablestime-shift
parent
d737c7d1d8
commit
f85d2ef970
|
@ -1,4 +1,4 @@
|
||||||
function oo_=evaluate_smoother(parameters,var_list)
|
function [oo_, Smoothed_variables_declaration_order_deviation_form]=evaluate_smoother(parameters,var_list)
|
||||||
% Evaluate the smoother at parameters.
|
% Evaluate the smoother at parameters.
|
||||||
%
|
%
|
||||||
% INPUTS
|
% INPUTS
|
||||||
|
@ -11,12 +11,17 @@ function oo_=evaluate_smoother(parameters,var_list)
|
||||||
% o oo [structure] results:
|
% o oo [structure] results:
|
||||||
% - SmoothedVariables
|
% - SmoothedVariables
|
||||||
% - SmoothedShocks
|
% - SmoothedShocks
|
||||||
% - SmoothedVariables
|
% - FilteredVariablesShockDecomposition
|
||||||
% - SmoothedVariables
|
% - UpdatedVariables
|
||||||
% - SmoothedVariables
|
% - FilteredVariables
|
||||||
% - SmoothedVariables
|
% - SmoothedMeasurementErrors
|
||||||
% - SmoothedVariables
|
% - FilteredVariablesKStepAhead
|
||||||
% - SmoothedVariables
|
% - FilteredVariablesKStepAheadVariances
|
||||||
|
% 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)
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% None
|
% None
|
||||||
|
@ -89,4 +94,8 @@ end
|
||||||
|
|
||||||
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend] = ...
|
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend] = ...
|
||||||
DsgeSmoother(parameters,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state);
|
DsgeSmoother(parameters,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state);
|
||||||
[oo_]=write_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend);
|
[oo_]=write_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend);
|
||||||
|
|
||||||
|
if nargout==2
|
||||||
|
Smoothed_variables_declaration_order_deviation_form=atT(oo_.dr.inv_order_var(bayestopt_.smoother_var_list),:);
|
||||||
|
end
|
|
@ -19,7 +19,7 @@ function oo_ = shock_decomposition(M_,oo_,options_,varlist)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2009-2013 Dynare Team
|
% Copyright (C) 2009-2016 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -62,7 +62,7 @@ if isempty(parameter_set)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
oo = evaluate_smoother(parameter_set,varlist);
|
[oo,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist);
|
||||||
|
|
||||||
% reduced form
|
% reduced form
|
||||||
dr = oo.dr;
|
dr = oo.dr;
|
||||||
|
@ -77,16 +77,15 @@ A = dr.ghx;
|
||||||
B = dr.ghu;
|
B = dr.ghu;
|
||||||
|
|
||||||
% initialization
|
% initialization
|
||||||
gend = eval(['size(oo.SmoothedShocks.' M_.exo_names(1,:),',1)']);
|
gend = size(oo.SmoothedShocks.(M_.exo_names(1,:)),1);
|
||||||
epsilon=NaN(nshocks,gend);
|
epsilon=NaN(nshocks,gend);
|
||||||
for i=1:nshocks
|
for i=1:nshocks
|
||||||
epsilon(i,:) = eval(['oo.SmoothedShocks.' M_.exo_names(i,:)]);
|
epsilon(i,:) = oo.SmoothedShocks.(M_.exo_names(i,:));
|
||||||
end
|
end
|
||||||
|
|
||||||
z = zeros(endo_nbr,nshocks+2,gend);
|
z = zeros(endo_nbr,nshocks+2,gend);
|
||||||
for i=1:endo_nbr
|
|
||||||
z(i,end,:) = eval(['oo.SmoothedVariables.' M_.endo_names(i,:)]);
|
z(:,end,:) = Smoothed_Variables_deviation_from_mean;
|
||||||
end
|
|
||||||
|
|
||||||
maximum_lag = M_.maximum_lag;
|
maximum_lag = M_.maximum_lag;
|
||||||
lead_lag_incidence = M_.lead_lag_incidence;
|
lead_lag_incidence = M_.lead_lag_incidence;
|
||||||
|
|
Loading…
Reference in New Issue