Commit f2cde3b6 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

Make schur_vec_tol settable and document it

Related to Dynare/preprocessor!29
Also convert it to lowercase as all other options
parent 84566ada
...@@ -9829,6 +9829,12 @@ Performing identification analysis ...@@ -9829,6 +9829,12 @@ Performing identification analysis
Tolerance level for selecting non-zero singular values. Tolerance level for selecting non-zero singular values.
Default: ``1.e-3``. 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* *Identification Strength Options*
.. option:: no_identification_strength .. option:: no_identification_strength
......
...@@ -98,7 +98,7 @@ end ...@@ -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); [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); iky = iv(ivar);
if ~isempty(u) 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); ivar = oo_.dr.order_var(iky);
end end
......
...@@ -46,7 +46,7 @@ options_.gstep(2) = 1.0; ...@@ -46,7 +46,7 @@ options_.gstep(2) = 1.0;
options_.scalv = 1; options_.scalv = 1;
options_.debug = false; options_.debug = false;
options_.initval_file = 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 % transition matrix
options_.qz_criterium = []; options_.qz_criterium = [];
options_.qz_zero_threshold = 1e-6; options_.qz_zero_threshold = 1e-6;
......
...@@ -139,6 +139,8 @@ options_ident = set_default_option(options_ident,'tol_deriv',1.e-8); ...@@ -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 % tolerance level for selecting columns of non-zero derivatives
options_ident = set_default_option(options_ident,'tol_sv',1.e-3); options_ident = set_default_option(options_ident,'tol_sv',1.e-3);
% tolerance level for selecting non-zero singular values in identification_checks.m % 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 %check whether to compute identification strength based on information matrix
if ~isfield(options_ident,'no_identification_strength') if ~isfield(options_ident,'no_identification_strength')
...@@ -289,7 +291,7 @@ if options_ident.order == 3 ...@@ -289,7 +291,7 @@ if options_ident.order == 3
end end
options_.ar = options_ident.ar; options_.ar = options_ident.ar;
options_.prior_mc = options_ident.prior_mc; 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_.nomoments = 0;
options_.analytic_derivation=options_ident.analytic_derivation; 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 % 1: analytic derivation of gradient and hessian of likelihood in dsge_likelihood.m, only works for stationary models, i.e. kalman_algo<3
......
...@@ -48,7 +48,7 @@ n = length(i_var); ...@@ -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); [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 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,:); ghx = ghx(i_stat,:);
ghu = ghu(i_stat,:); ghu = ghu(i_stat,:);
else else
......
...@@ -372,7 +372,7 @@ stationary_vars = (1:y_nbr)'; ...@@ -372,7 +372,7 @@ stationary_vars = (1:y_nbr)';
if ~isempty(Schur_u) if ~isempty(Schur_u)
%base this only on first order, because if first-order is stable so are the higher-order pruned systems %base this only on first order, because if first-order is stable so are the higher-order pruned systems
x = abs(gx*Schur_u); 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 end
if compute_derivs == 1 if compute_derivs == 1
......
...@@ -143,8 +143,8 @@ if local_order == 2 || options_.hp_filter == 0 ...@@ -143,8 +143,8 @@ if local_order == 2 || options_.hp_filter == 0
stationary_vars = (1:length(ivar))'; stationary_vars = (1:length(ivar))';
if ~isempty(u) if ~isempty(u)
x = abs(ghx*u); x = abs(ghx*u);
iky = iky(find(all(x(iky,:) < 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)); stationary_vars = find(all(x(inv_order_var(ivar(stationary_vars)),:) < options_.schur_vec_tol,2));
end end
aa = ghx(iky,:); aa = ghx(iky,:);
bb = ghu(iky,:); bb = ghu(iky,:);
......
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