Commit fa9f6ac9 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added option lik_init=4. Initialization of the Kalman filter/smoother with the...

Added option lik_init=4. Initialization of the Kalman filter/smoother with the fixed point of the Riccati equation.
parent f0addc9e
......@@ -81,6 +81,8 @@ if estim_params_.nvn
H(k,k) = xparam1(i+offset)*xparam1(i+offset);
end
offset = offset+estim_params_.nvn;
else
H = zeros(nobs);
end
if estim_params_.ncx
for i=1:estim_params_.ncx
......@@ -189,6 +191,14 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
kalman_algo = 3;
end
[Z,ST,R1,QT,Pstar,Pinf] = schur_statespace_transformation(mf,T,R,Q,options_.qz_criterium);
elseif options_.lik_init==4
% Start from the solution of the Riccati equation.
[err, Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))),H);
mexErrCheck('kalman_steady_state',err);
Pinf = [];
if kalman_algo~=2
kalman_algo = 1;
end
end
if kalman_algo == 2
end
......
......@@ -108,6 +108,10 @@ mf = bayestopt_.smoother_mf;
Q = M_.Sigma_e;
H = M_.H;
if isequal(H,0)
H = zeros(nobs,nobs);
end
kalman_algo = options_.kalman_algo;
if options_.lik_init == 1 % Kalman filter
if kalman_algo ~= 2
......@@ -126,6 +130,14 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
kalman_algo = 3;
end
[Z,ST,R1,QT,Pstar,Pinf] = schur_statespace_transformation(mf,T,R,Q,options_.qz_criterium);
elseif options_.lik_init == 4
% Start from the solution of the Riccati equation.
[err, Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,nobs)),H);
mexErrCheck('kalman_steady_state',err);
Pinf = [];
if kalman_algo~=2
kalman_algo = 1;
end
end
kalman_tol = options_.kalman_tol;
riccati_tol = options_.riccati_tol;
......@@ -133,9 +145,6 @@ data1 = Y-trend;
% -----------------------------------------------------------------------------
% 4. Kalman smoother
% -----------------------------------------------------------------------------
if isequal(H,0)
H = zeros(nobs,nobs);
end
if ~missing_value
for i=1:smpl
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment