# Gap-Trend model

**URL:** <https://forum.dynare.org/t/gap-trend-model/27950>\
**Category:** ML/Bayesian estimation\
**Created:** [2 September 2025 19:47 UTC](https://forum.dynare.org/t/gap-trend-model/27950 "2025-09-02T19:47:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [2 September 2025 19:47 UTC](https://forum.dynare.org/t/gap-trend-model/27950/1 "2025-09-02T19:47:17Z")

</div>

Hello Dynare folks,

I am estimating and Gap-Trend model where unit root exist in some equations as in the definition of the quarterly (Q on Q) inflation, DL\_P = 4(P-P(-1)) where P is the log of CPI.

Given the model is linear, I tried to solve for Steady state values as advised in previous posts and use -steady\_state\_model- however although DL\_P (annualized quarterly inflation) steady state is known in the SS (which is the inflation target) , then how to get/obtain price level of steady state where, again, DL\_P = 4(P-P(-1)) . In steady state P=P(-1) so how it is possible to get the steady value of unit root variable P=log(CPI) ?

Thx a lot

---

<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 September 2025 20:38 UTC](https://forum.dynare.org/t/gap-trend-model/27950/2 "2025-09-02T20:38:17Z")

</div>

The steady state of a unit root variable is not uniquely defined. Typically, in estimation you can simply put any value for that variable, it should not matter with the `diffuse_filter`.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [2 September 2025 20:52 UTC](https://forum.dynare.org/t/gap-trend-model/27950/3 "2025-09-02T20:52:33Z")

</div>

Thank you for the reply.I have mis-interpret the problem. I should have said that I am after simulating the model and get the IRFs 🙂. Namely, should I impose any arbitrary value for P in DL\_P = 4(P-P(-1)) given P is a unit root process and if DL\_P is constant (inflation target value) then P becomes unit root with drift ?

---

<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 September 2025 06:22 UTC](https://forum.dynare.org/t/gap-trend-model/27950/4 "2025-09-03T06:22:28Z")

</div>

Yes, for simulations you can impose any value you like. If you want to have a drift, you need a linear model and use the `nocheck` option of `steady`. See

> [@Can Dynare estimate this SSM model?](https://forum.dynare.org/t/can-dynare-estimate-this-ssm-model/25756/11):
>
> @rrremedio Usually Dynare can handle this. e.g. and But as a user, you need to know what you are doing.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [3 September 2025 07:16 UTC](https://forum.dynare.org/t/gap-trend-model/27950/5 "2025-09-03T07:16:49Z")

</div>

Thank you alot. May I ask something trivial ?

In the example you provided in the second link:

mmu= mmu(-1) + bbeta(-1) + e\_lev/1000 ;

Bbeta(-1) goes to bbeta\_const= 0.0075, then mmu shouldnt be regarded as unit root with a drift ?

I am a bit confused since as I know that when a drift exists then there is not solution at all. In this case (as in the equation above where mmu is a unit root with drift) then imposing arbitrary numbers still work ?

---

<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 September 2025 07:29 UTC](https://forum.dynare.org/t/gap-trend-model/27950/6 "2025-09-03T07:29:11Z")

</div>

That is the point of the `nocheck` option. You override trying to compute the steady state because it does not exist. But in a linear model, the steady state values will not matter for the slope of the policy function, so it’s fine.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [3 September 2025 07:30 UTC](https://forum.dynare.org/t/gap-trend-model/27950/7 "2025-09-03T07:30:01Z")

</div>

Thank you alot 🙂

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [6 September 2025 01:05 UTC](https://forum.dynare.org/t/gap-trend-model/27950/8 "2025-09-06T01:05:52Z")

</div>

Hi,

Regarding the steady state values for linear models we discussed above:

First, in general , the linearization of a linear equation is itself, then the policy function (that solves the system of FOC) is nothing but these same equations without any steady state variables in these equations. Therefore, in order to simulate a linear model why I need , in the first place, to assign/or solve for steady state variables ?

Second, if my logic is right in the first point, then it is the same reason why your response above reads **“But in a linear model, the steady state values will not matter for the slope of the policy function, so it’s fine”** therefore what I infer is that assigning the steady state variables in linear case for **stationary and non stationary** variables is nothing but a procedure to let the simulation start but has no effect .

Is this right ? Thank you

---

<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 September 2025 06:37 UTC](https://forum.dynare.org/t/gap-trend-model/27950/9 "2025-09-08T06:37:08Z")

</div>

Yes, that is correct. For standard models, you need the steady state values and Dynare by default checks whether it can compute a steady state. You need to override this to run your simulation when no steady state exists.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [8 September 2025 11:20 UTC](https://forum.dynare.org/t/gap-trend-model/27950/11 "2025-09-08T11:20:37Z")

</div>

Thank you dear @jpfeifer

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [3 October 2025 09:00 UTC](https://forum.dynare.org/t/gap-trend-model/27950/12 "2025-10-03T09:00:24Z")

</div>

Hi again,

I have a follow up question regarding the discussion above we have earlier.

Aside from unit root issue that we discussed above. If the linearization of linear equations is the equations its self and the fact that steady state values in a linear model do not affect the slope of the decision rule (solution) then why in models such as Gali and monacelli (2008) which is also replicated on your website we have solved for a steady state values ?

**Couldnt we impose arbitrary values for steady state and use -no check- since there is no effect on the model’s solution nor on linearization of the equations**?

---

<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:** [6 October 2025 07:52 UTC](https://forum.dynare.org/t/gap-trend-model/27950/13 "2025-10-06T07:52:22Z")

</div>

I only replicated Gali/Monacelli (2005) and do not solve for a steady state there. But those models are linear. Checking that the steady state is zero verifies that the linearized equations satisfy the consistency requirement of not containing a constant.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [6 October 2025 19:14 UTC](https://forum.dynare.org/t/gap-trend-model/27950/14 "2025-10-06T19:14:38Z")

</div>

Thank you. Yes I am referring to your 2005 replication.

Aside from checking whether steady state values are zeros or not, we can (hypothetically speaking) impose any arbitrary values and use -no check- and proceed as usual . Yeah ?

Note: .I am bringing this up just to confirm to myself that in linear models steady state values have no effect on policy function. Do you agree on the above ?

---

<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 October 2025 13:07 UTC](https://forum.dynare.org/t/gap-trend-model/27950/15 "2025-10-07T13:07:08Z")

</div>

Yes, I agree.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [11 October 2025 21:32 UTC](https://forum.dynare.org/t/gap-trend-model/27950/16 "2025-10-11T21:32:17Z")

</div>

One last thing Dr., 🙂 . In this case (Linear models, Gap and trend case) where some variables are in log deviations (Gaps) while others are in 100\* log (Trends). Then IRF are percentage deviations ONLY for gap variables but what about trend variables ? In the case of IRFs for trend variables then I have to use -exp()- for trend variables **only** , otherwise IRFs of trend variables wont be neither percentage deviations nor absolute deviations? Right ?

---

<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:** [12 October 2025 17:34 UTC](https://forum.dynare.org/t/gap-trend-model/27950/17 "2025-10-12T17:34:25Z")

</div>

I am not sure I understand. If you have a

> [@Alia](#):
>
> 100\* log (Trends)

then the log renders the model non-linear. Also, whenever you have logs, the IRFs generated in Dynare by `stoch_simul` will be in log deviations from the baseline (usually the steady state).

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [12 October 2025 18:46 UTC](https://forum.dynare.org/t/gap-trend-model/27950/18 "2025-10-12T18:46:48Z")

</div>

Thank you . If the entered equation in Dynare lets say Y = Y\_gap + Y\_trend then dynare will see the model as linear despite the fact that Y\_trend is defined in logarithmic scale since Y is in logarithmic scale by definition. In this case the linearization of the model is itself so no deviations from steady state is carried out.

So how I interpret IRF for a shock to Y\_trend . My understanding is IRFs of Y\_trend is neither percentage deviations nor absolute deviation **since in the linearization did not lead to deviations from SS**. Accordingly should I declare exp(Y\_trend) in the equations to come up with percentage deviations in the IRF of Y\_trend ?

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [20 October 2025 11:16 UTC](https://forum.dynare.org/t/gap-trend-model/27950/19 "2025-10-20T11:16:23Z")

</div>

Any advise please @jpfeifer

---

<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:** [20 October 2025 11:47 UTC](https://forum.dynare.org/t/gap-trend-model/27950/20 "2025-10-20T11:47:21Z")

</div>

I am still not sure what the exact question is. Dynare by default always does a linearization. If something happens to be in logs, then you obtain a log-linearization. That’s why the `exp()` substitution is sometimes done in non-linear models. If you now have a linear model where the objects are actually logarithms, then you will get percentage deviations in IRFs etc.

---

<div class="post-metadata">

**Author:** ![Alia](https://forum.dynare.org/user_avatar/forum.dynare.org/alia/32/21413_2.png) [@Alia](https://forum.dynare.org/u/Alia)\
**Post date:** [20 October 2025 12:02 UTC](https://forum.dynare.org/t/gap-trend-model/27950/21 "2025-10-20T12:02:51Z")

</div>

Please correct my understanding:

In Nonlinear models, linearization leads to variables in absolute or log deviations depending on variable’s measurement i.e. if the modeL is multiplicative per say then linearization of the FOC leads to variables in deviations c = C - C\_ss and this is why at steady steady state c=0 and IRF is absolute or percentage deviation.

On the other hand, if the model is **linear** then linearization of linear model is itself and will not leads to variables in deviation form and this is the source of my confusion.

Thank you prof.

[Next page](https://forum.dynare.org/t/gap-trend-model/27950.md?page=2)
