Problem with ZLB implementation

I want to ask some clarifications.

  1. I guess you meant adding the smoother option in the estimation command or the smoother 2histval command after the estimation command.
  2. When you say “simulation for different scenarios”, do you mean the conditional_forecast command or simply the simul or stoch_simul command in which I have to specify values of a particular shock at specific periods?
  1. No, you would need to set the undocumented options_.occbin.simul.endo_init, which stores the value of the initial condition of the variables in declaration order in deviations from the steady state (zero by default).
  2. No, you would have to specify the shocks(surprise) and then call occbin_solver to solve the simulation.

Okay I get what you said. However, for 1. does it mean you cannot use historical data (real data or smoothed variables from a previous estimation) as initial values ?

You can use the results, but you have to copy them to the field yourself instead of relying on an existing command.

Thank you, I will continue from there.

Hello Prof. Pfeifer, following our last discussion, I have a question. I first run an estimation with the smoother2histval command. Then I want to use the outfile with the option you suggested. However, not only the outfile containts auxiliary variables but also the variables are not in the declaration order. Is there a way to map the input of options_.occbin.simul.endo_init with the output of the outfile from the smoother2histval command?

And secondly, what about lagged variables, since they are not explicity declared in the model declaration. I might be not undrstanding something

I think I was able to solve my problem manually as you suggested. However, a sufficiently strong shock leads to an interest rate lower than the bound I have fixed. Any insight of what I am doing wrong?

Without seeing the codes, it is impossible to tell.

And I impose a strong enough negative shock, the interest rate drops under the bound

  1. How did you judge that? The initial condition will not be returned by the simulations.
  2. Can you provide the files to replicate the interest rate issue?
  1. I had in mind that the first period of simulations would be the initial condition.
  2. sorry but I am not able to get those results again, that I got only by adding a strongly negative choc (Shock_YGAP_SHK or Shock_R1N_SHK). But I try that now, the interest does not fall under the lower bound. But what is also weird is that the shadow rate does not fall too.
occbin_constraints;
name 'zlb'; bind R1N_ZLB <= 0-1e8; relax R1N_ZLB > 0+1e8;
end;

cannot be right. You meant 1e-8, I guess.

Yes you are right. Things work fine now, in the simpler version of the model. Thanks a lot for your time. If anyone is interested in a macro financial forecasting model, I would be glad to post my codes

I would be interested in the final implementation. I may serve as a useful cross-check for future features.

main_dynare should run everything. Please feel free to give suggestions, comments or critics about how I try to handle things. Thank you.

I did think it was better to continue with thismy question here. There is something weird happening with the interaction between occbin and the estimation.
when l estimate my, the hessian is not positive definite (mode compute = 4), the log density is NAN but occbin is able to converge towards the solution.
But if I use mode compute = 6, the hessian is positive but occbin fails to converge : Reference to non-existent field ‘opts_algo’.
Could it be a bug?

The first one is not unusual. Having found a mode does not mean that the Hessian at this mode can be computed numerically or that the result is positive definite. That explains the log density, which requires the Hessian to be positive definite.
The second issue sounds like a bug. Can you please provide more details on the error message?

Thank you for your answer. This is the message.

Reference to non-existent field ‘opts_algo’.
Error in occbin.kalman_update_algo_3 (line 293)
if occbin_options.opts_algo.restrict_state_space
Error in missing_DiffuseKalmanSmootherH3_Z (line 336)
[ax, a1x, Px, P1x, vx, Fix, Kix, Tx, Rx, Cx, tmp, error_flag, M_, aha, etaha,TTx,RRx,CCx] =
occbin.kalman_update_algo_3(a(:,t-1),a1(:,t-1:t),P(:,:,t-1),P1(:,:,t-1:t),data_index(t-1:t),Z,v(:,t-1:t),Fi(:,t-1),Ki(:,:,t-1),Y(:,t-1:t),H,Qt,T0,R0,TT(:,:,t-1:t),RR(:,:,t-1:t),CC(:,t-1:t),regimes_(t:t+1),M_,oo_,options_,occbin_options,kalman_tol,nk);
Error in DsgeSmoother (line 322)
[alphahat,epsilonhat,etahat,ahat,P,aK,PK,decomp,state_uncertainty, aahat, eehat, d, regimes_,TT,RR,CC] =
missing_DiffuseKalmanSmootherH3_Z(a_initial,ST, …
Error in occbin.DSGE_smoother (line 120)
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T0,R0,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_]
= DsgeSmoother(xparam1,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_,occbin_options);%
T1=TT;
Error in dynare_estimation_1 (line 599)
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_]
=
occbin.DSGE_smoother(xparam1,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state,M_,oo_,options_,bayestopt_,estim_params_,dataset_,dataset_info);
Error in dynare_estimation (line 118)
dynare_estimation_1(var_list,dname);
Error in model_complet44.driver (line 1695)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

Sorry for being the guinea pig that finds all the bugs and thank you for reporting them. A fix is at kalman_update_algo_3.m: correct options name (!2090) · Merge requests · Dynare / dynare · GitLab

1 Like