varexo
%The duration for which the nominal interest rate remains constrained at the zero lower bound is determined exogenously by the value of eps_zlb
eps_zlb (long_name= 'Indicator variable for the zero lower bound.')
%Interest rate value during rate targeting.
eps_rzlb (long_name= 'Interest rate target')
;
model;
%Temporary variable for simulating the ZLB.
%Similar to the setup method in NK_ZLB_discretion.mod as found in %https://mutschler.eu/dynare/occassionally-binding-%constraints/nk_video_zlb/#nk_zlb_discretionmod.
#rr=eps_zlb*eps_rzlb + (1-eps_zlb)*r_taylor;
......
%26
[name='Monetary policy.']
@#if talyor== 1
%Taylor's Rule.
log(1+r_taylor)=(1-rho_r)*log(1+rss)+rho_r*log(1+r_taylor(-1))+rho_rpi*((pi-piss)/piss)+rho_ry*log(y/y(-1))-eps_r;
......
%34
[name='Actual nominal interest rate']
r=max(rr,0);
......end;
%Setting for deterministic shocks.
%ZLB test
......
shocks;
%By using eps_rzlb, the interest rate can be reduced below 0, and other targeted interest rate values can also be set.
var eps_rzlb;
%Duration of interest rate targeting.
periods 1:50;
%Target interest rate
%If it is below 0, the preceding ZLB constraint will cause it to be set to 0.
values -1;
%Use the ZLB indicator exogenous variable to set the duration for targeting the interest rate.
var eps_zlb;
%Duration of interest rate targeting.
periods 1:50;
values 1;
end;
Here is the core part of my interest rate targeting setup, extracted from the mod file I uploaded, with the commented sections highlighted. The principle is to set an exogenous shock, eps_zlb, and then establish a temporary variable rr and an endogenous variable r_taylor to represent the interest rate according to Taylor’s Rule. Using the equation #rr=eps_zlb*eps_rzlb + (1-eps_zlb)*r_taylor; I set eps_zlb=1 for periods 1 to n, then set the value of eps_rzlb, which essentially makes the value of rr equal to the value of eps_rzlb during these periods. After period n, eps_zlb=0, and rr=r_taylor, switching to Taylor’s Rule. Utilizing r=max(rr,0), I assign this value to the interest rate variable in my original model, thereby imposing the ZLB constraint.