# Nonzero residuals of static equations

**URL:** https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442
**Category:** Steady state
**Created:** [26 March 2020 03:56 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442 "2020-03-26T03:56:05Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![rss](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rss](https://forum.dynare.org/u/rss)
#### Post date: [26 March 2020 03:56 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/1 "2020-03-26T03:56:06Z")

</div>

Hi professor  
I have two equations:  
1- b=d+kb  
2- jb=rb_b-rd_d.  
In steady state model block i use these two equations as below:  
1- d=ln(exp(b)-exp(kb));  
2- jb=ln(exp(rb)\*exp(b)-exp(d)\*exp(d));

But in residuals of static equations part, the residuals of two equations mentioned earlier are nonzero.  
Would you please help me?  
Best regards.  
[AAA.mod](https://forum.dynare.org/uploads/short-url/gyMl6K6BrJuvSg8ddHg24OdbNc2.mod) (16.5 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: [28 March 2020 07:18 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/2 "2020-03-28T07:18:17Z")

</div>

Your equations above are impossible to read, because some multiplication signs must be missing.

It is usually better to work with auxiliary equations to get a log-linearization. See [Question about understanding irfs in dynare](https://forum.dynare.org/t/question-about-understanding-irfs-in-dynare/10622/4)

---

<div class="post-metadata">

### Author: ![rss](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rss](https://forum.dynare.org/u/rss)
#### Post date: [28 March 2020 16:29 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/3 "2020-03-28T16:29:01Z")

</div>

Excuse me  
the two equations are:  
1- b=d+kb;  
2- jb=b_rb-d_rd  
thanks for your tips, but if you see the steady state model block i find the steady state value of all variables by mentioned method and residuals of all get zero instead of 2 mentioned equations.  
would you please check it again?  
Best regards

---

<div class="post-metadata">

### Author: ![rss](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rss](https://forum.dynare.org/u/rss)
#### Post date: [29 March 2020 05:58 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/4 "2020-03-29T05:58:02Z")

</div>

Hi professor  
as you said in the topics, I performed an exp() substituion and the right form of above equations are:  
1- exp(b)=exp(d)+exp(kb);  
2-exp(jb)=exp(b)\*exp(rb)-exp(d)\*exp(rd);  
would you now check the model again?

---

<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: [30 March 2020 13:07 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/5 "2020-03-30T13:07:39Z")

</div>

In

```auto
d=log(exp(b)-exp(kb));

```

you are getting a negative number inside of the bracket.

---

<div class="post-metadata">

### Author: ![rss](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rss](https://forum.dynare.org/u/rss)
#### Post date: [30 March 2020 16:43 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/6 "2020-03-30T16:43:43Z")

</div>

Excuse me professor  
How do you understand that the exparation (ln(exp(b)-exp(kb)) become negative?  
Because i experience this problem before and dynare give an error that “resid: The initial values for the steady state of the following variables are complex”.  
But dynare do not give me this error now?  
How i can fix the 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: [30 March 2020 17:48 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/7 "2020-03-30T17:48:18Z")

</div>

You can execute the parameter definitions and the steady state model equations using F9 in Matlab. You will then see the problem. Tip: use % instead of // to add comments. Otherwise Matlab will complain if you execute lines with appended comments.

---

<div class="post-metadata">

### Author: ![HelloDynare](https://forum.dynare.org/user_avatar/forum.dynare.org/hellodynare/32/12107_2.png) [@HelloDynare](https://forum.dynare.org/u/HelloDynare)
#### Post date: [7 May 2020 13:18 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/8 "2020-05-07T13:18:35Z")

</div>

> [@rss](#):
>
> Excuse me  
> the two equations are:  
> 1- b=d+kb;  
> 2- jb=b _rb-d_ rd  
> thanks for your tips, but if you see the steady state model block i find the steady state value of all variables by mentioned method and residuals of all get zero instead of 2 mentioned equations.  
> would you please check it again?

Hi Prof. jpfeifer, I have similar doubts.

If my model has, e.g. 20 equations, by `resid` MATLAB/dynare only reports the first 2 equations nonzero,

does it mean (i) I only need to check these 2 equations,  
or (ii) I have to check all 20 equations  
to remove these 2 nonzeros??

---

<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 May 2020 13:30 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/9 "2020-05-07T13:30:18Z")

</div>

This means that all equation may be wrong, but for debugging, the place to start are the two equations with non-zero residuals.

---

<div class="post-metadata">

### Author: ![HelloDynare](https://forum.dynare.org/user_avatar/forum.dynare.org/hellodynare/32/12107_2.png) [@HelloDynare](https://forum.dynare.org/u/HelloDynare)
#### Post date: [7 May 2020 14:06 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/10 "2020-05-07T14:06:14Z")

</div>

Furthermore, one follow-up question:  
This post is in “Steady state” category, does it mean  
(i) I only need to check my steady-state settings/file,  
or (ii) the whole equation system and my model settings may have flaws??

---

<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 May 2020 09:01 UTC](https://forum.dynare.org/t/nonzero-residuals-of-static-equations/15442/11 "2020-05-08T09:01:40Z")

</div>

Option ii). Your entered equations and the computed steady state values are inconsistent. There must be a mistake somewhere, but it is unclear whether it is the model equations or the steady state computation that has the mistake.
