discretionary_policy: Add check whether equation number is consistent with declared number of instruments

Also fixes unit test that violated this.
time-shift
Johannes Pfeifer 2015-08-30 11:43:54 +02:00
parent 3b64c37cb3
commit 9e504a1293
2 changed files with 9 additions and 4 deletions

View File

@ -88,7 +88,13 @@ end
eq_nbr= size(jacobia_,1);
instr_nbr=endo_nbr-eq_nbr;
if instr_nbr==0
error('discretionary_policy:: There are no available instruments, because the model has as many equations as variables.')
end
if size(Instruments,1)~= instr_nbr
error('discretionary_policy:: There are more declared instruments than omitted equations.')
end
instr_id=nan(instr_nbr,1);
for j=1:instr_nbr
vj=deblank(Instruments(j,:));

View File

@ -19,7 +19,7 @@ y = y(+1) -(omega/sigma)*(i-pi(+1))+g;
pi = beta*pi(+1)+kappa*y+u;
pi_c = pi+(alpha/(1-alpha))*(q-q(-1));
q = q(+1)-(1-alpha)*(i-pi(+1))+(1-alpha)*e;
i = 1.5*pi;
% i = 1.5*pi;
end;
shocks;
@ -29,6 +29,5 @@ var e; stderr 1;
end;
planner_objective pi_c^2 + y^2;
discretionary_policy(instruments=(i),irf=0,qz_criterium=0.999999);
discretionary_policy(instruments=(i),irf=0,planner_discount=beta);