From 0a6dd582382cf20e72c807207e92be7c44750cc1 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 21 Mar 2025 08:20:00 +0100
Subject: [PATCH] initial_estimation_checks.m: ensure that mh_drop has valid
 value

Prevents cryptic crashes
---
 matlab/estimation/initial_estimation_checks.m | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/matlab/estimation/initial_estimation_checks.m b/matlab/estimation/initial_estimation_checks.m
index 03596d646e..148a219d52 100644
--- a/matlab/estimation/initial_estimation_checks.m
+++ b/matlab/estimation/initial_estimation_checks.m
@@ -161,6 +161,10 @@ if (any(bayestopt_.pshape  >0 ) && options_.mh_replic) && options_.mh_nblck<1
     error('initial_estimation_checks:: Bayesian estimation cannot be conducted with mh_nblocks=0.')
 end
 
+if options_.mh_drop<0 || options_.mh_drop>=1
+    error('initial_estimation_checks:: mh_drop must be in [0,1).')    
+end
+
 % check and display warnings if steady-state solves static model (except if diffuse_filter == 1) and if steady-state changes estimated parameters
 [oo_.steady_state] = check_steady_state_changes_parameters(M_,estim_params_,oo_,options_, [options_.diffuse_filter==0 options_.diffuse_filter==0] );
 
-- 
GitLab