# Model\_diagnostics

**URL:** <https://forum.dynare.org/t/model-diagnostics/2178>\
**Category:** Dynare help (legacy posts)\
**Created:** [4 October 2011 09:49 UTC](https://forum.dynare.org/t/model-diagnostics/2178 "2011-10-04T09:49:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![boskar](https://forum.dynare.org/user_avatar/forum.dynare.org/boskar/32/6615_2.png) [@boskar](https://forum.dynare.org/u/boskar)\
**Post date:** [4 October 2011 09:49 UTC](https://forum.dynare.org/t/model-diagnostics/2178/1 "2011-10-04T09:49:39Z")

</div>

How to use this function: **model\_diagnostics(M\_,options\_,oo\_)** to see displayed statements about for example colinearities in my model equations?  
I run my loglinearized model with stoch\_simul and get some error messages about not satisfying the Blanchard-Kahn condition. I would like to investigate what is the reason of this problem. The nonlinear version of the model works well. So I don’t understand what can be wrong with the loglinearized version (all steady state values of variables set to 0, steady state parameters provided from steady state computation wich works for the nonlinear model, number of forward-looking variables is 6 and is consistent with nonlinear version, but number of eigenvalues bigger in modulus than one is now 11 instead of 6).  
Is it possible to get more information about model behaviour/properties with **model\_diagnostics**?

---

<div class="post-metadata">

**Author:** ![boskar](https://forum.dynare.org/user_avatar/forum.dynare.org/boskar/32/6615_2.png) [@boskar](https://forum.dynare.org/u/boskar)\
**Post date:** [11 October 2011 14:24 UTC](https://forum.dynare.org/t/model-diagnostics/2178/2 "2011-10-11T14:24:49Z")

</div>

Anybody ?  
I have corrected my equations and now I have in the log-linearized version 7 eigenvalues larger in modulus than one. So there is some progress. But this still doesn’t fit the number of anticipated variables which is 6. Here I give eigenvalues of both versions of the model: nonlinear and linear.  
**nonlinear:**  
EIGENVALUES:  
Modulus Real Imaginary  
7.077e-017 -7.077e-017 0  
1.207e-015 -1.207e-015 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.83 0.83 0  
0.83 0.83 0  
0.9567 0.9567 0  
0.9711 0.9711 0  
1.058 1.058 0  
1.108 1.108 0  
Inf Inf 0  
Inf Inf 0  
Inf Inf 0  
Inf Inf 0  
There are 6 eigenvalue(s) larger than 1 in modulus  
for 6 forward-looking variable(s)  
The rank condition is verified.  
**linear:**  
EIGENVALUES:  
Modulus Real Imaginary  
4.542e-018 4.542e-018 0  
6.718e-017 -6.718e-017 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.5 0.5 0  
0.83 0.83 0  
0.83 0.83 0  
0.9567 0.9567 0  
**1.012 1.012 0.02744  
1.012 1.012 -0.02744**  
1.058 1.058 0  
Inf Inf 0  
Inf Inf 0  
Inf Inf 0  
Inf Inf 0  
**There are 7 eigenvalue(s) larger than 1 in modulus  
for 6 forward-looking variable(s)**  
The rank conditions ISN’T verified!  
I know the way of proceeding in such cases - checking staedy state, timing of variables, model equations, simplifying, checking parameters’ values. But I would like to know if there is some tricky way of detecting the source of problem. If there is for example the way of making some diadnostics of the model (the model is just stochstically simulated here).  
And another question. What is the reason of occuring the complex eigenvalue? Maybe this would help me to find the reason of the problem with the lack of stable solution.  
Any answers, comments, clues will be kindly seen  
Karolina

---

<div class="post-metadata">

**Author:** ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)\
**Post date:** [27 October 2011 15:13 UTC](https://forum.dynare.org/t/model-diagnostics/2178/3 "2011-10-27T15:13:47Z")

</div>

model\_diagnostics is a command under development and not yet officially released. This is the reason why there is no documentation.

Best,

---

<div class="post-metadata">

**Author:** ![boskar](https://forum.dynare.org/user_avatar/forum.dynare.org/boskar/32/6615_2.png) [@boskar](https://forum.dynare.org/u/boskar)\
**Post date:** [22 April 2012 16:33 UTC](https://forum.dynare.org/t/model-diagnostics/2178/4 "2012-04-22T16:33:56Z")

</div>

After executing a file with a model by /dynare modelfile\_name/ write directly in the command window: /model\_diagnostics(M\_, options\_, oo\_)/. It can give some useful information. For example how many colinerities there is in the model.

---

<div class="post-metadata">

**Author:** ![ericlearndynare](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/c4cdca/32.png) [@ericlearndynare](https://forum.dynare.org/u/ericlearndynare)\
**Post date:** [8 June 2012 09:07 UTC](https://forum.dynare.org/t/model-diagnostics/2178/5 "2012-06-08T09:07:01Z")

</div>

> [@boskar](#):
>
> After executing a file with a model by /dynare modelfile\_name/ write directly in the command window: /model\_diagnostics(M\_, options\_, oo\_)/. It can give some useful information. For example how many colinerities there is in the model.

Excuse me, but can anyone please show how to execute the model\_diagnostics function? Let’s say the mod. file is called “a.mod”, endo\_nbr = 68,maximum\_lag = 1,maximum\_lead = 1  
How to run it ? Any response is much appreciated. Thanks!  
Eric

---

<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:** [8 June 2012 09:24 UTC](https://forum.dynare.org/t/model-diagnostics/2178/6 "2012-06-08T09:24:31Z")

</div>

After running the mod-file, just type

```auto

```

into Matlab

---

<div class="post-metadata">

**Author:** ![ericlearndynare](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/c4cdca/32.png) [@ericlearndynare](https://forum.dynare.org/u/ericlearndynare)\
**Post date:** [8 June 2012 11:12 UTC](https://forum.dynare.org/t/model-diagnostics/2178/7 "2012-06-08T11:12:00Z")

</div>

[quote=“jpfeifer”]After running the mod-file, just type

```auto
model_diagnostics(M_,options_,oo_)
```

into Matlab[/quote]

This followsing is what i got, i don’t know what’s wrong

> > model\_diagnostics(M\_,options\_,oo\_)  
> > ??? Error using ==\> svd  
> > Input to SVD must not contain NaN or Inf.

Error in ==\> rank at 15  
s = svd(A);

Error in ==\> model\_diagnostics at 131  
rank\_jacob = rank(jacob);

---

<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:** [8 June 2012 11:35 UTC](https://forum.dynare.org/t/model-diagnostics/2178/8 "2012-06-08T11:35:58Z")

</div>

Did you put

`steady;
check;
`  
into your mod-file?

---

<div class="post-metadata">

**Author:** ![ericlearndynare](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/c4cdca/32.png) [@ericlearndynare](https://forum.dynare.org/u/ericlearndynare)\
**Post date:** [8 June 2012 11:43 UTC](https://forum.dynare.org/t/model-diagnostics/2178/9 "2012-06-08T11:43:35Z")

</div>

[quote=“jpfeifer”]Did you put

`steady;
check;
`  
into your mod-file?[/quote]

I am totally a beginner in Dynare, is it still necessary to put in “check”/“steady” in the codes, cause it’s already linearized and the steady has been solved by hand.

---

<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:** [9 June 2012 09:02 UTC](https://forum.dynare.org/t/model-diagnostics/2178/10 "2012-06-09T09:02:17Z")

</div>

You should always put it there to let Dynare check if your computations are correct. I would guess your error message results from a mistake in computing the steady state/uninitialized parameters.

---

<div class="post-metadata">

**Author:** ![Oriana](https://forum.dynare.org/letter_avatar_proxy/v4/letter/o/96bed5/32.png) [@Oriana](https://forum.dynare.org/u/Oriana)\
**Post date:** [18 September 2015 11:04 UTC](https://forum.dynare.org/t/model-diagnostics/2178/11 "2015-09-18T11:04:21Z")

</div>

Dear all,

I got the following message:

Estimation::mcmc: Posterior (dsge) IRFs…  
Estimation::mcmc: Posterior IRFs, done!  
Warning: Matrix is singular to working precision.

> In missing\_DiffuseKalmanSmootherH3\_Z at 257  
> In DsgeSmoother at 236  
> In dynare\_estimation\_1 at 504  
> In dynare\_estimation at 92  
> In nonlinearomega at 2209  
> In dynare at 223  
> Prior distribution for parameter c1rhomuc has two modes!  
> Prior distribution for parameter c1rhoomegacm1 has two modes!  
> Warning: Range cannot be used in ‘basic’ mode. The entire  
> sheet will be loaded.  
> In xlsread at 199  
> In load\_xls\_file\_data at 77  
> In dseries.dseries at 131  
> In makedataset at 103  
> In dynare\_estimation\_init at 531  
> In evaluate\_smoother at 54  
> In shock\_decomposition at 60  
> In nonlinearomega at 2222  
> In dynare at 223  
> Warning: Matrix is singular to working precision.  
> In missing\_DiffuseKalmanSmootherH3\_Z at 257  
> In DsgeSmoother at 236  
> In evaluate\_smoother at 90  
> In shock\_decomposition at 60  
> In nonlinearomega at 2222  
> In dynare at 223  
> Total computing time : 6h11m10s  
> Note: warning(s) encountered in MATLAB/Octave code  
> Your MATLAB session has timed out. All license keys have been returned.
> 
> > model\_diagnostics(M\_,options\_,oo\_)  
> > MODEL\_DIAGNOSTICS: No obvious problems with this mod-file were detected.

Accordingly to the model diagnostic command there are no obvious problems. I also selected steady and check in my mode file. Can I rely on my results?

---

<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:** [21 September 2015 06:53 UTC](https://forum.dynare.org/t/model-diagnostics/2178/12 "2015-09-21T06:53:39Z")

</div>

Those are warnings that can occur in big models. Is there anything suspicious about the results?

---

<div class="post-metadata">

**Author:** ![superztt](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@superztt](https://forum.dynare.org/u/superztt)\
**Post date:** [7 March 2016 04:31 UTC](https://forum.dynare.org/t/model-diagnostics/2178/13 "2016-03-07T04:31:30Z")

</div>

What does it mean if there is nothing returned after I type in model\_diagnostics(M\_,options\_,oo\_)? Btw, I wanted to figure out why BK condition doesn’t hold in my model.

---

<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:** [7 March 2016 08:24 UTC](https://forum.dynare.org/t/model-diagnostics/2178/14 "2016-03-07T08:24:23Z")

</div>

It means that nothing obvious turned up during the diagnostics.

Usually when the BK conditions fail, it is a timing error.
