Change options_.lik_init to default value if the fixed point of the Riccati equation cannot be found.

time-shift
Stéphane Adjemian (Charybdis) 2011-06-28 14:46:43 +02:00
parent f2450932da
commit e097f7c8db
1 changed files with 13 additions and 6 deletions

View File

@ -193,15 +193,22 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
[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
if kalman_algo ~= 2
kalman_algo = 1;
end
if isequal(H,0)
[err,Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))));
else
[err,Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))),H);
end
if err
disp(['I am not able to solve the Riccati equation so I switch to lik_init=1!']);
options_.lik_init = 1;
Pstar = lyapunov_symm(T,R*Q*R',options_.qz_criterium,options_.lyapunov_complex_threshold);
end
Pinf = [];
end
if kalman_algo == 2
end
kalman_tol = options_.kalman_tol;
riccati_tol = options_.riccati_tol;
mf = bayestopt_.mf1;