# Occbin error in kalman filter

**URL:** <https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506>\
**Category:** Occbin\
**Created:** [1 October 2024 15:08 UTC](https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506 "2024-10-01T15:08:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfellmann](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jfellmann](https://forum.dynare.org/u/jfellmann)\
**Post date:** [1 October 2024 15:08 UTC](https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506/1 "2024-10-01T15:08:34Z")

</div>

Hi!

I’m trying to use occbin to estimate a model, but I get an error that I don’t know what it means.

The complete error message is

missing\_observations\_kalman\_filter:PKF failed in period 1 with: Occbin: Simulation terminated with periodic solution (no convergence).  
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.

Error in initial\_estimation\_checks (line 248)  
print\_info(info, options\_.noprint, options\_)

Error in dynare\_estimation\_1 (line 165)  
oo\_ = initial\_estimation\_checks(objective\_function,xparam1,dataset\_,dataset\_info,M\_,estim\_params\_,options\_,bayestopt\_,bounds,oo\_);

Error in dynare\_estimation (line 105)  
dynare\_estimation\_1(var\_list,dname);

Error in steady\_modelV9.driver (line 1797)  
oo\_recursive\_=dynare\_estimation(var\_list\_);

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

Here are the files  
[data\_use.mat](https://forum.dynare.org/uploads/short-url/2ThPFhiJqcPoC5HyoUM5gqpx1bz.mat) (22.7 KB)  
[steady\_modelV9.mod](https://forum.dynare.org/uploads/short-url/tcCpG2CTfBHQKkHRsjXe9uMd8ur.mod) (18.8 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [3 October 2024 06:52 UTC](https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506/2 "2024-10-03T06:52:26Z")

</div>

Does a simulated version of the model work?

---

<div class="post-metadata">

**Author:** ![jfellmann](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jfellmann](https://forum.dynare.org/u/jfellmann)\
**Post date:** [3 October 2024 11:37 UTC](https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506/3 "2024-10-03T11:37:02Z")

</div>

Yes! the simulation works perfectly

Right. So now the estimation no longer gives the error, which means I must have done something to fix it.  
The problem is that it gets stucked after plotting the priors, I’m guessing in the initialization of the likelihood.  
Is this normal? Also, I’m not sure I’m introducing the occbin estimation set up properly

[steady\_modelV9.mod](https://forum.dynare.org/uploads/short-url/abB6nE84D3vfFBy5TLzftHtF7yU.mod) (19.3 KB)  
[data\_use.mat](https://forum.dynare.org/uploads/short-url/lAFRwIL6HcnQX4HrUCGxIKT9ZX3.mat) (22.7 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [4 October 2024 20:28 UTC](https://forum.dynare.org/t/occbin-error-in-kalman-filter/26506/4 "2024-10-04T20:28:40Z")

</div>

Did you let it run for a long time? I quickly had a look and the first likelihood computation indeed takes a long time due to a large number of periods with shocks and many iterations per period required.
