Hi,
I am trying to run an estimation using the inversion filter for a linearized model with OccBin. However, I am encountering the problem with shock parameterization when I setting up the shock variances, even if I change their values. I would appreciate any help and suggestions.
What exactly is the issue you are facing?
Using the Inversion Filter, I think I am encountering a similar problem as in the NKM.mod file with the smoother, which I sent you in another topic
Unrecognized field name "linear_smoother".
Error in occbin.DSGE_smoother (line 140)
etahat= oo_.occbin.linear_smoother.etahat;
Error in prior_posterior_statistics_core (line 233)
occbin.DSGE_smoother(deep,gend,Y,data_index,missing_value,M_,oo_,opts_local,bayestopt_,estim_params_);
Error in prior_posterior_statistics (line 234)
[fout] = prior_posterior_statistics_core(localVars,1,B,0);
Error in dynare_estimation_1 (line 548)
oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts
Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);
Error in ModelZLB2.driver (line 855)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 308)
evalin('base',[fname '.driver']);
Error in runsimIF (line 43)
dynare ModelZLB2.mod noclearall;
Additionally, I tried to estimate the model with PKF, but it also gives an error during the likelihood calculation. Could you please take a look at it? I have sent it to you in a DM
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
> In occbin.kalman_update_algo_1 (line 102)
In occbin.kalman_update_engine (line 55)
In missing_observations_kalman_filter (line 276)
In dsge_likelihood (line 639)
In initial_estimation_checks (line 207)
In dynare_estimation_1 (line 165)
In dynare_estimation (line 105)
In ModelZLB2.driver (line 858)
In dynare (line 308)
In runsimIFandPKF (line 43)
missing_observations_kalman_filter:PKF failed in period 26 with: Piecewise linear Kalman filter: updated state vector is NaN.
Error in computing likelihood for initial parameter values
ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: If this is not a problem with the setting of options (check the error message below),
ESTIMATION_CHECKS: you should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):
Error using print_info (line 33)
Error using print_info (line 33)
Piecewise linear Kalman filter: There was a problem in obtaining the likelihood.
Thanks for reporting this. The first is a bug that should be fixed in 🐛 Enable smoother_inversion_filter option with MCMC (!2325) · Merge requests · Dynare / dynare · GitLab
The second issue we need to investigate further.
Dear @jpfeifer
Thank you very much. Regarding the first bug, can I run the code on the unstable version?
Best,
Not yet. But you can download the package created by the pipeline to the above ticket. See the screenshot:
Thank you, @jpfeifer !
Any update on this second bug?
Kind of. @rattoma looked into it and found:
The issue here is the bad practice of eliminating one shock and one data point at the ZLB. The goal is to prevent stochastic singularity when the regime is binding and the monetary shock is missing at the ELB. However, during estimation the actual regime in each period is uncertain, which implies that sometimes the estimated regime may be estimated to be binding while it is not in the data. In that case, we try to observe 3 series (in this case) with only 2 shocks available (since the monetary shock disappears at the ELB). This generates inf log-likelihood.
But I would consider this as unproblematic. You will only get the error message if the parameter estimate predicts the constraint to bind when it is not binding. In that case, we should discard the parameter draw due to its likelihood being 0. If the problem appears for the initial data point, you need to modify the starting values.
Was the package listed above merged into the stable release of Dynare 6.3?
Still getting missing_observations_kalman_filter:PKF failed in period 10 with: Piecewise linear Kalman filter: updated state vector is NaN.
for a simple estimation exercise with OccBin.
Yes, it was merged. What you report is something different. I will have a look.
For future reference: the problem was caused by a wrong specification of the ZLB and the associated data. The model implied the ZLB to bind, dropping the monetary policy shock. However, there were still all observables as the data did not account for the ZLB binding due to a wrong cutoff.