# Matrix not positive definite Bayesian estimation

**URL:** <https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402>\
**Category:** ML/Bayesian estimation\
**Created:** [23 March 2024 10:59 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402 "2024-03-23T10:59:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mab1688](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mab1688](https://forum.dynare.org/u/mab1688)\
**Post date:** [23 March 2024 10:59 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/1 "2024-03-23T10:59:09Z")

</div>

Hi everyone,

I’m trying to replace the estimates of Kiley (2020) “[What Can the Data Tell Us About the Equilibrium Real Interest Rate?](https://www.ijcb.org/journal/ijcb20q2a5.htm)”

I’m running into problems in the estimation step and get the error: “Matrix must be positive definite.” I’m attaching the Dynare file and data here.

I’m not sure what’s causing the error and would really appreciate any guidance. Thank you very much.

[data.xlsx](https://forum.dynare.org/uploads/short-url/1ymWkJNp1TBvomFjlgD9MRigoWU.xlsx) (40.9 KB)  
[kiley.mod](https://forum.dynare.org/uploads/short-url/yKDY5aWuXKREcQlFvDQvBtf14Qw.mod) (1.8 KB)

---

<div class="post-metadata">

**Author:** ![eisamabodian](https://forum.dynare.org/user_avatar/forum.dynare.org/eisamabodian/32/12023_2.png) [@eisamabodian](https://forum.dynare.org/u/eisamabodian)\
**Post date:** [23 March 2024 21:30 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/2 "2024-03-23T21:30:30Z")

</div>

I run your model with mode\_compute=6 option in my laptop altough I think that it is better to use 8 different observable variables for 8 shocks.

I think you have collinearity in your observable variables in your model, altough I am not sure completely, but I have a similar personal experience about this issue. When I used Y , C , I as observable variables I encountered with Dynare output error.

" Matrix must be positive definite" .

I canged one of the variables and the problem solved completely with mode\_compute =4

---

<div class="post-metadata">

**Author:** ![mab1688](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mab1688](https://forum.dynare.org/u/mab1688)\
**Post date:** [24 March 2024 17:25 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/3 "2024-03-24T17:25:49Z")

</div>

Thank you very much. It runs when I set mode\_compute=6 too but the resulting posteriors are very different from the paper, and I suspect this could be related to whatever’s causing mode\_compute=4 to break.

My observable variables are just GDP growth, the unemployment rate, realized inflation, inflation expectations, and the nominal funds rate, so it seems odd that there would be collinearity in the data. It could be an identification problem, but I’m trying to stick to the exact specification in the paper so I must be getting something wrong in my set-up. Not sure what, though.

---

<div class="post-metadata">

**Author:** ![eisamabodian](https://forum.dynare.org/user_avatar/forum.dynare.org/eisamabodian/32/12023_2.png) [@eisamabodian](https://forum.dynare.org/u/eisamabodian)\
**Post date:** [24 March 2024 20:42 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/5 "2024-03-24T20:42:17Z")

</div>

As I said I am not completely sure about the collinearity of the variables. The error’s main reason may be different. I said only for my personal experience about the similar problem.

---

<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:** [25 March 2024 09:29 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/6 "2024-03-25T09:29:15Z")

</div>

You should focus on your observation equations. All your variables have a zero steady state, but the data are not mean 0. That can create a lot of problems.

---

<div class="post-metadata">

**Author:** ![mab1688](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mab1688](https://forum.dynare.org/u/mab1688)\
**Post date:** [25 March 2024 13:09 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/7 "2024-03-25T13:09:43Z")

</div>

Thank you very much. The issue persists when I demean the data (updated data file attached).  
[data.xlsx](https://forum.dynare.org/uploads/short-url/zAkbJg0U6l6pt03edZTLJNY1zOh.xlsx) (42.4 KB)

---

<div class="post-metadata">

**Author:** ![eisamabodian](https://forum.dynare.org/user_avatar/forum.dynare.org/eisamabodian/32/12023_2.png) [@eisamabodian](https://forum.dynare.org/u/eisamabodian)\
**Post date:** [25 March 2024 18:42 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/8 "2024-03-25T18:42:13Z")

</div>

Can you test your datafile variables with other four different variables ??

---

<div class="post-metadata">

**Author:** ![mab1688](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mab1688](https://forum.dynare.org/u/mab1688)\
**Post date:** [25 March 2024 19:09 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/9 "2024-03-25T19:09:52Z")

</div>

You mean replace them with completely random series? I’m not sure that would help because I’d still want to work with this data, and I suspect that I’m probably specifying something incorrectly (rather than this being an underlying property of this fairly standard dataset). I’m just not sure what that could be.

---

<div class="post-metadata">

**Author:** ![eisamabodian](https://forum.dynare.org/user_avatar/forum.dynare.org/eisamabodian/32/12023_2.png) [@eisamabodian](https://forum.dynare.org/u/eisamabodian)\
**Post date:** [25 March 2024 19:36 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/10 "2024-03-25T19:36:30Z")

</div>

No, I don’t mean random series at all.

Replace for example with different variables.

---

<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:** [26 March 2024 09:06 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/11 "2024-03-26T09:06:31Z")

</div>

You can try the attached file in Dynare 6.0:  
[kiley.mod](https://forum.dynare.org/uploads/short-url/7z4ZSVoguhG8z8yBsGXzzBjj9Wu.mod) (1.8 KB)  
[data.xlsx](https://forum.dynare.org/uploads/short-url/zAkbJg0U6l6pt03edZTLJNY1zOh.xlsx) (42.4 KB)

---

<div class="post-metadata">

**Author:** ![mab1688](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/82dd89/32.png) [@mab1688](https://forum.dynare.org/u/mab1688)\
**Post date:** [26 March 2024 15:43 UTC](https://forum.dynare.org/t/matrix-not-positive-definite-bayesian-estimation/25402/12 "2024-03-26T15:43:23Z")

</div>

This works, thank you very much!
