ZLB implemention and occbin_constraints

dear professor,I’m solving a model with ZLB and use occbin_constraints to implement it.But when I run the model,the shocks seem do not work, so as the ZLB condition.I don’t know why this happenned.Could you please help me to find where the problems are? Thanks and best wishes!
test1.mod (8.3 KB)

I change the shocks as follows:
shockssequence =[-0.2,-0.2,-0.2];
shocks(surprise,overwrite);
var eps_a;
periods 1:3;
values (shockssequence);
end;

when I change the shocks,and reach the zero lower bound, the proccess will lead to the error as follow:

In occbin.mkdatap_anticipated_dyn (line 109)
In occbin.solve_one_constraint (line 189)
In occbin.solver (line 78)
In test1.driver (line 711)
In dynare (line 281)
Warning: The matrix is close to singular value, or scaled incorrectly. Results may not be accurate。RCOND = 3.447937e-19。
occbin solver:: period 3::
Did not converge – increase maxit.

I guess the problem is in the occbin_solver(),but I don’t konw how to correct it . Could you please help me to find the reason?

You did not provide all files to run your code.

Thank you for helping me. After changing the shocks,the mod document is
test1.mod (8.5 KB)

Today,I also learn from a mod document (
baseline_model.mod (5.0 KB))
and then I wrote a new mod document
test2.mod (12.3 KB)
I tried to solve the problem that “The matrix is close to singular value, or scaled incorrectly.”. But when run the progress, the new mistake occurred.The results are as follows:
dynare test2
Starting Dynare (version 5.3).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 35 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs …
done
Preprocessing completed.

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.

Residuals of the static equations:

Equation number 1 : -1.7183 : 随机折现因子
Equation number 2 : -0.0010004 : 消费决定方程
Equation number 3 : 9.022714515480534e+72 : 有效消费
Equation number 4 : -0.023819 : 货币供给量决定方程
Equation number 5 : -10.7823 : 劳动供给方程
Equation number 6 : 1.7358 : 存款持有决定方程
Equation number 7 : 3.0983 : 杠杆
Equation number 8 : 0 : 银行资产迁移
Equation number 9 : 0.54572 : 辅助方程1
Equation number 10 : -0.99616 : 辅助方程2
Equation number 11 : -2.203697026708854e+44 : 银行利润最大化
Equation number 12 : 2.5627 : 银行部门总的净资产迁移公式
Equation number 13 : 0.0067353 : 净资产变化率
Equation number 14 : 2.0166 : 生产函数
Equation number 15 : 0 : 资本投入
Equation number 16 : 0.54825 : 工资
Equation number 17 : 0.19349 : 利息支付
Equation number 18 : 0.63324 : 净投资
Equation number 19 : -1.7183 : 投资调整成本
Equation number 20 : -5.4495 : 最优资本价格
Equation number 21 : -0.27076 : 最优通胀率
Equation number 22 : 1.7569 : 辅助方程3
Equation number 23 : 10.1683 : 辅助方程4
Equation number 24 : -3.1664 : 通胀与最优通胀
Equation number 25 : 2.6765 : 市场出清
Equation number 26 : 0 : 资本转移
Equation number 27 : -5.7222 : 总体价格
Equation number 28 : 0.0099498 : 泰勒规则
Equation number 29 : 0 : Deposite rate
Equation number 30 : -0.024267 : 政府购买
Equation number 31 : 0.025468 : 税收收入
Equation number 32 : 1.001336836798032e+22 : 政府预算约束
Equation number 33 : 0 : 技术冲击
Equation number 34 : 0 : 偏好冲击
Equation number 35 : 0 : 资本冲击

错误使用 print_info (line 32)
The steadystate file did not compute the steady state

出错 steady (line 102)
print_info(info,options_.noprint, options_);

出错 test2.driver (line 657)
steady;

出错 dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

a clearer version of test2.mod
test2.mod (11.0 KB)

The steady_helper1.m is still missing.

My mind is full of how to solve the model, and I forget that I used functions when calculatingthe steady state. Sorry for wasting your time due to my personal negligence, the file has been uploaded. Thank you for helping me so patiently.
steady_helper1.m (185 Bytes)

Only do the exp()-substitution once the model works.

Sorry,i don’t quite understand the meaning of this sentence.I do the exp()-substitution in test2.mod, but the model still not work, I don’t konw how to solve the error “The steadystate file did not compute the steady state” .Could you please describe this more clearly?

I check the model again,and correct some tpye error,the problem still exists. the newest version is
test2.mod (11.0 KB)

You are currently doing an exp()-substitution to get the responses in logs. Only do that once the model works. The huge residuals indicate that most probably something went wrong here when replacing variables.

Now, I return to the original model to make the model work first, but I still get the error like follows:
In occbin.mkdatap_anticipated_dyn (line 109)
In occbin.solve_one_constraint (line 189)
In occbin.solver (line 78)
In test1.driver (line 712)
In dynare (line 281)
Warning: The matrix is close to singular value, or scaled incorrectly. Results may not be accurate. RCOND = 2.155939e-18。
Incorrect use of print_info (line 32)
Occbin: Simulation did not converge, increase maxit or check_ahead_periods.

Error occbin.solver (line 85)
print_info(error_flag, options_.noprint, options_)

Error test1.driver (line 712)
oo_ = occbin.solver(M_, oo_, options_);

Error dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

the model run when there’s only two periods and doesn’t reach ZLB. It seems that once the model reach ZLB,the error occurs.
test1.mod (8.6 KB)

Are you sure the ZLB and the timing of interest rates are correctly implemented? For one thing, the ZLB needs to specified in terms of the notional interest rate rnop. At the ZLB, R=1, so the relax R>1; will never happen.

Moreover, equations like

mu_m*(M(-1)/P(-1))^(-mu)+beta*lambda*(P(-1)/P)=lambda(-1);
K(1)=K+In;

look rather unusual.

Dear,Professor! Finally I done this and make the ZLB works! Thanks to your reminder, I checked the original model again, and fixed some minor bugs, then he problems were solved. Sincerely thanks for your help again!

Now I encounter another problem. My model wants to examine the effect of fiscal policy under the zero interest rate floor. And now that I have simulated the zero interest rate lower bound, what function do I use if I want to examine the impact of an increase in fiscal spending? I don’t know if you have some reference materials or codes that I am able to refer to.

You need a fiscal rule and then you need to shock it.

I have included fiscal spending rules in the model. The current problem is that I have examined the negative impact of technology can form a zero interest rate lower bound, I want to further examine how effective a positive fiscal expenditure shock is in response to negative technology shock . Because there is already a technical shock, add the positive shock of fiscal expenditure G in the mod file, Dynare will only identify it as two independent shocks, so that I cannot examine the effect of fiscal policy.

test1.mod (8.7 KB)
the courrent mod file is above. I’m thinking that maybe I need to write a .m file ?Actually,I have no ideas now :sob:

The shocks(surprise)-block allows for doing shock combinations.