diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m
index 3495a7d04a04825ca72b49aabca0880bc5f1d056..c893be9c63ded305bbcf704a5a657a659ff91d21 100644
--- a/matlab/dynare_estimation_init.m
+++ b/matlab/dynare_estimation_init.m
@@ -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
diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m
index 70788e0577d3b5a122951b034f182704fdee9ac0..063f4e451c91fc7dd117707f8f41695aafe4d792 100644
--- a/matlab/dynare_identification.m
+++ b/matlab/dynare_identification.m
@@ -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;
diff --git a/tests/identification/kim/kim2.mod b/tests/identification/kim/kim2.mod
index 6322b8da446444a67c4199490acf814ce43b7b55..9ab32dfc34709f82072ea372b8fce6a750bf2e3e 100644
--- a/tests/identification/kim/kim2.mod
+++ b/tests/identification/kim/kim2.mod
@@ -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);