removing useless 'd' output argument from the Kalman smoother functions. Removed global initialization of options_.diffuse_d. Fixed minor bugs in Kalman smoother functions.

time-shift
Michel Juillard 2011-03-24 15:45:16 +01:00
parent acf385b58a
commit 5f8b5fa467
4 changed files with 6 additions and 13 deletions

View File

@ -153,7 +153,7 @@ if kalman_algo == 1 || kalman_algo == 2
end
if kalman_algo == 1 || kalman_algo == 3
[alphahat,epsilonhat,etahat,ahat,P,aK,PK,d,decomp] = missing_DiffuseKalmanSmootherH1_Z(ST, ...
[alphahat,epsilonhat,etahat,ahat,P,aK,PK,decomp] = missing_DiffuseKalmanSmootherH1_Z(ST, ...
Z,R1,Q,H,Pinf,Pstar, ...
data1,nobs,np,smpl,kalman_tol,riccati_tol,data_index);
if isequal(alphahat,0)
@ -179,7 +179,7 @@ if kalman_algo == 2 || kalman_algo == 4
end
end
[alphahat,epsilonhat,etahat,ahat,P,aK,PK,d,decomp] = missing_DiffuseKalmanSmootherH3_Z(ST, ...
[alphahat,epsilonhat,etahat,ahat,P,aK,PK,decomp] = missing_DiffuseKalmanSmootherH3_Z(ST, ...
Z,R1,Q,diag(H),Pinf,Pstar,data1,nobs,np,smpl,data_index);
end

View File

@ -151,7 +151,6 @@ options_.MaximumNumberOfMegaBytes = 111;
options_.PosteriorSampleSize = 1000;
options_.bayesian_irf = 0;
options_.bayesian_th_moments = 0;
options_.diffuse_d = [];
options_.diffuse_filter = 0;
options_.filter_step_ahead = [];
options_.filtered_vars = 0;

View File

@ -1,4 +1,4 @@
function [alphahat,epsilonhat,etahat,atilde,P,aK,PK,d,decomp] = missing_DiffuseKalmanSmootherH1_Z(T,Z,R,Q,H,Pinf1,Pstar1,Y,pp,mm,smpl,kalman_tol,riccati_tol,data_index)
function [alphahat,epsilonhat,etahat,atilde,P,aK,PK,decomp] = missing_DiffuseKalmanSmootherH1_Z(T,Z,R,Q,H,Pinf1,Pstar1,Y,pp,mm,smpl,kalman_tol,riccati_tol,data_index)
% function [alphahat,epsilonhat,etahat,a, aK] = DiffuseKalmanSmoother1(T,Z,R,Q,H,Pinf1,Pstar1,Y,pp,mm,smpl)
% Computes the diffuse kalman smoother without measurement error, in the case of a non-singular var-cov matrix
@ -30,8 +30,6 @@ function [alphahat,epsilonhat,etahat,atilde,P,aK,PK,d,decomp] = missing_DiffuseK
% matrices
% PK: 4D array of k-step ahead forecast error variance
% matrices (meaningless for periods 1:d)
% d: number of periods where filter remains in diffuse part
% (should be equal to the order of integration of the model)
% decomp: decomposition of the effect of shocks on filtered values
%
% SPECIAL REQUIREMENTS
@ -247,7 +245,7 @@ if d
end
end
if nargout > 7
if nargout > 8
decomp = zeros(nk,mm,rr,smpl+nk);
ZRQinv = inv(Z*QQ*Z');
for t = max(d,1):smpl

View File

@ -1,4 +1,4 @@
function [alphahat,epsilonhat,etahat,a,P,aK,PK,d,decomp] = missing_DiffuseKalmanSmootherH3_Z(T,Z,R,Q,H,Pinf1,Pstar1,Y,pp,mm,smpl,data_index)
function [alphahat,epsilonhat,etahat,a,P,aK,PK,decomp] = missing_DiffuseKalmanSmootherH3_Z(T,Z,R,Q,H,Pinf1,Pstar1,Y,pp,mm,smpl,data_index)
% function [alphahat,epsilonhat,etahat,a1,P,aK,PK,d,decomp_filt] = missing_DiffuseKalmanSmoother3_Z(T,Z,R,Q,Pinf1,Pstar1,Y,pp,mm,smpl)
% Computes the diffuse kalman smoother without measurement error, in the case of a singular var-cov matrix.
% Univariate treatment of multivariate time series.
@ -28,8 +28,6 @@ function [alphahat,epsilonhat,etahat,a,P,aK,PK,d,decomp] = missing_DiffuseKalman
% matrices
% PK: 4D array of k-step ahead forecast error variance
% matrices (meaningless for periods 1:d)
% d: number of periods where filter remains in diffuse part
% (should be equal to the order of integration of the model)
% decomp: decomposition of the effect of shocks on filtered values
%
% SPECIAL REQUIREMENTS
@ -274,9 +272,7 @@ if d
end
end
disp('smoother done');
if nargout > 7
if nargout > 8
decomp = zeros(nk,mm,rr,smpl+nk);
ZRQinv = inv(Z*QQ*Z');
for t = max(d,1):smpl