🐛 Fix issue with endogenous params in steady state
Identification should switch to analytic_derivation_mode=-2 if steady state block/file changes parameter values. Dynare/dynare!1732 already adresses this when there is a prior specified. This fix also addresses this when there are no priors. kim2.mod is now not only an integration test but also a unit test for this.time-shift
parent
347be1f89a
commit
97134cc362
|
@ -501,11 +501,15 @@ if options_.analytic_derivation
|
|||
error('analytic derivation is incompatible with diffuse filter')
|
||||
end
|
||||
options_.analytic_derivation = 1;
|
||||
if estim_params_.np
|
||||
if estim_params_.np || isfield(options_,'identification_check_endogenous_params_with_no_prior')
|
||||
% check if steady state changes param values
|
||||
M=M_;
|
||||
M.params(estim_params_.param_vals(:,1)) = xparam1(estim_params_.nvx+estim_params_.ncx+estim_params_.nvn+estim_params_.ncn+1:end); %set parameters
|
||||
M.params(estim_params_.param_vals(:,1)) = M.params(estim_params_.param_vals(:,1))*1.01; %vary parameters
|
||||
if isfield(options_,'identification_check_endogenous_params_with_no_prior')
|
||||
M.params = M.params*1.01; %vary parameters
|
||||
else
|
||||
M.params(estim_params_.param_vals(:,1)) = xparam1(estim_params_.nvx+estim_params_.ncx+estim_params_.nvn+estim_params_.ncn+1:end); %set parameters
|
||||
M.params(estim_params_.param_vals(:,1)) = M.params(estim_params_.param_vals(:,1))*1.01; %vary parameters
|
||||
end
|
||||
if options_.diffuse_filter || options_.steadystate.nocheck
|
||||
steadystate_check_flag = 0;
|
||||
else
|
||||
|
|
|
@ -270,6 +270,7 @@ if isempty(estim_params_)
|
|||
%reset some options
|
||||
options_ident.prior_mc = 1;
|
||||
options_ident.prior_range = 0;
|
||||
options_.identification_check_endogenous_params_with_no_prior = true; %needed to trigger endogenous steady state parameter check in dynare_estimation_init
|
||||
else
|
||||
prior_exist = 1;
|
||||
parameters = options_ident.parameter_set;
|
||||
|
|
|
@ -86,6 +86,12 @@ identification(advanced=1,max_dim_cova_group=3);
|
|||
//identification(ar=1,advanced=1,max_dim_cova_group=3,prior_mc=250);
|
||||
//identification(prior_mc=100);
|
||||
|
||||
% Unit test for analytic_derivation_mode
|
||||
load('kim2/identification/kim2_prior_mean_identif.mat','store_options_ident')
|
||||
if store_options_ident.analytic_derivation~=1 && store_options_ident.analytic_derivation_mode~=-2
|
||||
error('the steady state file changed parameters and we should switch to numerical derivatives for the steady state, i.e. analytic_derivation_mode=-2')
|
||||
end
|
||||
|
||||
% Integration test if identification works without priors
|
||||
estim_params_=[];
|
||||
identification(advanced=1,max_dim_cova_group=3);
|
||||
|
|
Loading…
Reference in New Issue