Make schur_vec_tol settable and document it

Related to https://git.dynare.org/Dynare/preprocessor/-/merge_requests/29
Also convert it to lowercase as all other options
time-shift
Johannes Pfeifer 2020-12-17 10:12:21 +01:00
parent 84566adac9
commit f2cde3b6d9
7 changed files with 15 additions and 7 deletions

View File

@ -9829,6 +9829,12 @@ Performing identification analysis
Tolerance level for selecting non-zero singular values.
Default: ``1.e-3``.
.. option:: schur_vec_tol = DOUBLE
Tolerance level used to find nonstationary variables in Schur decomposition
of the transition matrix.
Default: ``1.e-11``.
*Identification Strength Options*
.. option:: no_identification_strength

View File

@ -98,7 +98,7 @@ end
[vx, u] = lyapunov_symm(A,B*M_.Sigma_e*B',options_.lyapunov_fixed_point_tol,options_.qz_criterium,options_.lyapunov_complex_threshold,[],options_.debug);
iky = iv(ivar);
if ~isempty(u)
iky = iky(find(any(abs(ghx(iky,:)*u) < options_.Schur_vec_tol,2)));
iky = iky(find(any(abs(ghx(iky,:)*u) < options_.schur_vec_tol,2)));
ivar = oo_.dr.order_var(iky);
end

View File

@ -46,7 +46,7 @@ options_.gstep(2) = 1.0;
options_.scalv = 1;
options_.debug = false;
options_.initval_file = false;
options_.Schur_vec_tol = 1e-11; % used to find nonstationary variables in Schur decomposition of the
options_.schur_vec_tol = 1e-11; % used to find nonstationary variables in Schur decomposition of the
% transition matrix
options_.qz_criterium = [];
options_.qz_zero_threshold = 1e-6;

View File

@ -139,6 +139,8 @@ options_ident = set_default_option(options_ident,'tol_deriv',1.e-8);
% tolerance level for selecting columns of non-zero derivatives
options_ident = set_default_option(options_ident,'tol_sv',1.e-3);
% tolerance level for selecting non-zero singular values in identification_checks.m
options_ident = set_default_option(options_ident,'schur_vec_tol',1e-11);
% tolerance level used to find nonstationary variables in Schur decomposition of the transition matrix.
%check whether to compute identification strength based on information matrix
if ~isfield(options_ident,'no_identification_strength')
@ -289,7 +291,7 @@ if options_ident.order == 3
end
options_.ar = options_ident.ar;
options_.prior_mc = options_ident.prior_mc;
options_.Schur_vec_tol = 1.e-8;
options_.schur_vec_tol = options_ident.schur_vec_tol;
options_.nomoments = 0;
options_.analytic_derivation=options_ident.analytic_derivation;
% 1: analytic derivation of gradient and hessian of likelihood in dsge_likelihood.m, only works for stationary models, i.e. kalman_algo<3

View File

@ -48,7 +48,7 @@ n = length(i_var);
[vx,u] = lyapunov_symm(A,B*Sigma_e*B',options_.lyapunov_fixed_point_tol,options_.qz_criterium,options_.lyapunov_complex_threshold, [], options_.debug);
if size(u,2) > 0
i_stat = find(any(abs(ghx*u) < options_.Schur_vec_tol,2)); %only set those variances of objective function for which variance is finite
i_stat = find(any(abs(ghx*u) < options_.schur_vec_tol,2)); %only set those variances of objective function for which variance is finite
ghx = ghx(i_stat,:);
ghu = ghu(i_stat,:);
else

View File

@ -372,7 +372,7 @@ stationary_vars = (1:y_nbr)';
if ~isempty(Schur_u)
%base this only on first order, because if first-order is stable so are the higher-order pruned systems
x = abs(gx*Schur_u);
stationary_vars = find(all(x < options.Schur_vec_tol,2));
stationary_vars = find(all(x < options.schur_vec_tol,2));
end
if compute_derivs == 1

View File

@ -143,8 +143,8 @@ if local_order == 2 || options_.hp_filter == 0
stationary_vars = (1:length(ivar))';
if ~isempty(u)
x = abs(ghx*u);
iky = iky(find(all(x(iky,:) < options_.Schur_vec_tol,2)));
stationary_vars = find(all(x(inv_order_var(ivar(stationary_vars)),:) < options_.Schur_vec_tol,2));
iky = iky(find(all(x(iky,:) < options_.schur_vec_tol,2)));
stationary_vars = find(all(x(inv_order_var(ivar(stationary_vars)),:) < options_.schur_vec_tol,2));
end
aa = ghx(iky,:);
bb = ghu(iky,:);