From 317f9581844ad8feb3f7625529753463cb9dfb19 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Thu, 23 Jun 2016 20:48:01 +0200 Subject: [PATCH] Ramsey: Test whether number of instruments matches number of missing equation Otherwise cryptic crashes can result --- matlab/evaluate_steady_state.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/matlab/evaluate_steady_state.m b/matlab/evaluate_steady_state.m index 35110d651a..883357b5e6 100644 --- a/matlab/evaluate_steady_state.m +++ b/matlab/evaluate_steady_state.m @@ -54,6 +54,17 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta end if options.ramsey_policy + %test whether specification matches + inst_nbr = size(options.instruments,1); + if inst_nbr~=0 + orig_endo_aux_nbr = M.orig_endo_nbr + min(find([M.aux_vars.type] == 6)) - 1; + implied_inst_nbr = orig_endo_aux_nbr - M.orig_eq_nbr; + if inst_nbr>implied_inst_nbr + error('You have specified more instruments than there are omitted equations') + elseif inst_nbr<implied_inst_nbr + error('You have specified fewer instruments than there are omitted equations') + end + end if steadystate_flag % explicit steady state file [ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, ... -- GitLab