1function options_=select_qz_criterium_value(options_) 2% function options_=select_qz_criterium_value(options_) 3% set the value of options_.qz_criterium depending on the Kalman filter used 4% 5% INPUTS 6% options_: Dynare options structure 7% 8% OUTPUTS 9% options_: Dynare options structure 10% 11% SPECIAL REQUIREMENTS 12% none 13 14% Copyright (C) 2016-2017 Dynare Team 15% 16% This file is part of Dynare. 17% 18% Dynare is free software: you can redistribute it and/or modify 19% it under the terms of the GNU General Public License as published by 20% the Free Software Foundation, either version 3 of the License, or 21% (at your option) any later version. 22% 23% Dynare is distributed in the hope that it will be useful, 24% but WITHOUT ANY WARRANTY; without even the implied warranty of 25% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26% GNU General Public License for more details. 27% 28% You should have received a copy of the GNU General Public License 29% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 30 31 32% If options_.lik_init == 1 33% set by default options_.qz_criterium to 1-1e-6 34% and check options_.qz_criterium < 1-eps if options_.lik_init == 1 35% Else 36% set by default options_.qz_criterium to 1+1e-6 37stack = dbstack; 38 39if options_.particle.status 40 % Non linear filter 41 if isequal(options_.particle.initialization, 3) 42 if isempty(options_.qz_criterium) 43 options_.qz_criterium = 1+1e-6; 44 else 45 if options_.qz_criterium <= 1 46 fprintf('\n%s:: You set nonlinear_filter_initialization equal to 3, it is assumed that you try to estimate a non stationary model. Resetting it to 1+1e-6.\n', stack(2).file) 47 options_.qz_criterium = 1+1e-6; 48 end 49 end 50 else 51 if isempty(options_.qz_criterium) 52 options_.qz_criterium = 1-1e-6; 53 end 54 end 55else 56 % Linear filter 57 if isequal(options_.lik_init,1) 58 if isempty(options_.qz_criterium) 59 options_.qz_criterium = 1-1e-6; 60 elseif options_.qz_criterium > 1-eps 61 error([stack(2).file ': option qz_criterium is too large for estimating/smoothing ' ... 62 'a stationary model. If your model contains unit roots, use ' ... 63 'option diffuse_filter']) 64 end 65 else 66 if isempty(options_.qz_criterium) 67 options_.qz_criterium = 1+1e-6; 68 else 69 if options_.qz_criterium <= 1 70 fprintf('\n%s:: diffuse filter is incompatible with a qz_criterium<=1. Resetting it to 1+1e-6.\n',stack(2).file) 71 options_.qz_criterium = 1+1e-6; 72 end 73 end 74 end 75end