# The forecast error variance in the multivariate Kalman filter became singular for some priors

**URL:** <https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108>\
**Category:** ML/Bayesian estimation\
**Created:** [30 January 2025 07:44 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108 "2025-01-30T07:44:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vahagn](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/cc9497/32.png) [@vahagn](https://forum.dynare.org/u/vahagn)\
**Post date:** [30 January 2025 07:44 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/1 "2025-01-30T07:44:39Z")

</div>

Hi everyone, I am trying to estimate my DSGE model using bayesian estimation. The problem is that depending on prior values of my parameters the model sometimes returns me the error message “The forecast error variance in the multivariate Kalman  
filter became singular” and for some parameters it returns different error after trying to find the mode.

[baseline.mod](https://forum.dynare.org/uploads/short-url/1mL1TElofuyVAGyFaNx1fHoQQyp.mod) (16.9 KB)  
[estimation\_data.xlsx](https://forum.dynare.org/uploads/short-url/2zKAEohO39Zisu1MRzeqReMwUkp.xlsx) (25.6 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:** [31 January 2025 11:20 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/2 "2025-01-31T11:20:18Z")

</div>

Try analytic derivatives with `mode_compute=5`.  
[baseline.mod](https://forum.dynare.org/uploads/short-url/ilYYF7zyUU1Qj9QPIgCVppBm5YP.mod) (16.9 KB)

---

<div class="post-metadata">

**Author:** ![vahagn](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/cc9497/32.png) [@vahagn](https://forum.dynare.org/u/vahagn)\
**Post date:** [1 February 2025 16:23 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/3 "2025-02-01T16:23:40Z")

</div>

Thank You professor for Your reply. I tried as You said, but I am still getting the same error.

---

<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:** [2 February 2025 09:38 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/4 "2025-02-02T09:38:19Z")

</div>

In the unstable version, I obtained the following mode, which worked.  
[baseline\_mode.mat](https://forum.dynare.org/uploads/short-url/1hfjlG5cVqpARUQUAgYI1GG5ioi.mat) (12.6 KB)

---

<div class="post-metadata">

**Author:** ![vahagn](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/cc9497/32.png) [@vahagn](https://forum.dynare.org/u/vahagn)\
**Post date:** [2 February 2025 10:27 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/5 "2025-02-02T10:27:20Z")

</div>

I changed my Dynare version to the Dynare 6.2. Now I am getting another error using the code You provided.

````auto
Iteration 2
Error using * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the
first matrix matches the number of rows in the second matrix. To operate on each
element of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in csminit1 (line 77)
    dx = -H0*g;```
...
````

---

<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:** [2 February 2025 16:51 UTC](https://forum.dynare.org/t/the-forecast-error-variance-in-the-multivariate-kalman-filter-became-singular-for-some-priors/27108/6 "2025-02-02T16:51:22Z")

</div>

That is a known bug in 6.2 that will be fixed in 6.3. For now, you need the unstable version.
