# Comparing model with data after log-linearization

**URL:** <https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314>\
**Category:** Stochastic simulations\
**Created:** [23 November 2014 23:48 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314 "2014-11-23T23:48:17Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![bayes](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@bayes](https://forum.dynare.org/u/bayes)\
**Post date:** [28 February 2015 18:02 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/21 "2015-02-28T18:02:57Z")

</div>

Thanks! Another question, are the lecture slides from your course that you referred to in this topic available somewhere online? Or is it possible to get them from 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:** [1 March 2015 10:59 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/22 "2015-03-01T10:59:15Z")

</div>

No. If you send me an email, I can send the respective chapter to 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:** [2 March 2015 19:35 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/23 "2015-03-02T19:35:20Z")

</div>

@AS90: You need to be more precise. What are

```auto

```

Are the IRFs to temporary shocks estimated on non-stationary data? Or are the IRFs non-stationary, i.e. they show permanent effects of a temporary shock?

---

<div class="post-metadata">

**Author:** ![AS90](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@AS90](https://forum.dynare.org/u/AS90)\
**Post date:** [30 May 2015 16:29 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/24 "2015-05-30T16:29:44Z")

</div>

Thanks, sorry for the hiatus.

Yes, the first one you wrote. Non-stationary data IRFs: the IRFs are estimated on non-stationary data.  
Hence, is one to de-trend his DSGE model anyways if willing on reproducing said IRFs theoretically?

---

<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 May 2015 11:12 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/25 "2015-05-31T11:12:22Z")

</div>

In that case, you have to work with a detrended model and make sure the data are correctly matched to the stationary model variables. For example, you can use an observation equation with first differences. See Pfeifer(2013): [“A Guide to Specifying Observation Equations for the Estimation of DSGE Models”](https://drive.google.com/file/d/1r89OU5OE3CBa6tOlj6l3hNVWEaRH5Anv/view?usp=sharing).

---

<div class="post-metadata">

**Author:** ![AS90](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@AS90](https://forum.dynare.org/u/AS90)\
**Post date:** [31 May 2015 12:04 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/26 "2015-05-31T12:04:14Z")

</div>

Thank you. That paper is very useful, you had already notified it to me. But, right because of the indications therein, what I asked was: what if you do not want to render the data stationary? That is, what if you wish to reproduce IRFs estimated on non-stationary data: should you still de-trend your DSGE model or not? By logical rigour you shouldn’t, 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:** [31 May 2015 12:32 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/27 "2015-05-31T12:32:54Z")

</div>

In a sense, the data is still non-stationary if you use first differences as you are using an invertible transformation. But if you follow Canova’s most recent arguments, you should not be treating your data. However, that massively restricts what you can do in estimation. The reason you need to stationarize your model is that you need to have a well-defined approximation point for log-linearization/Taylor approximation. Thus, you have to use a mapping of the non-stationary data to the stationary model. If you find a way to use a non-stationary model, you might be able to get around this, but I am not aware of any decent way to achieve this.

---

<div class="post-metadata">

**Author:** ![AS90](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@AS90](https://forum.dynare.org/u/AS90)\
**Post date:** [31 May 2015 13:39 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/28 "2015-05-31T13:39:28Z")

</div>

True and elucidating. Thanks.

---

<div class="post-metadata">

**Author:** ![HEIDARZ](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/d9b06d/32.png) [@HEIDARZ](https://forum.dynare.org/u/HEIDARZ)\
**Post date:** [29 June 2020 06:53 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/29 "2020-06-29T06:53:17Z")

</div>

Is this also correct when the model is nonlinear?or we should compare the HP-filtered data moments with the HP-filtered theoretical moments.  
thanks

---

<div class="post-metadata">

**Author:** ![HEIDARZ](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/d9b06d/32.png) [@HEIDARZ](https://forum.dynare.org/u/HEIDARZ)\
**Post date:** [29 June 2020 08:45 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/30 "2020-06-29T08:45:49Z")

</div>

When i use HP filter command the computed(THEORETICAL) mean of one of the variables will be equal to zero and the others have negative values(-0.1609, -0.2561, -0.1609 , 0.0000) .Could this be correct?  
thanks

---

<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:** [29 June 2020 12:32 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/31 "2020-06-29T12:32:11Z")

</div>

Please see

> [@Demean the series or not](https://forum.dynare.org/t/demean-the-series-or-not/11130/4):
>
> Actually, it is a bit more complicated. With the one-sided HP filter, the mean will only be asymptotically 0. Thus, if your sample is short and depending on your view of the world, you still may want to demean. See also

---

<div class="post-metadata">

**Author:** ![HEIDARZ](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/d9b06d/32.png) [@HEIDARZ](https://forum.dynare.org/u/HEIDARZ)\
**Post date:** [29 June 2020 16:21 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/32 "2020-06-29T16:21:33Z")

</div>

Thank you dear professor  
The truth is, I’m still a beginner. would you please take a look at my file and tell me what i should to do?  
thanks.

[nkcc.mod](https://forum.dynare.org/uploads/short-url/9mS2vgZfKqVApIGlPVMU0wlxdIT.mod) (8.3 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:** [30 June 2020 08:32 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/33 "2020-06-30T08:32:22Z")

</div>

What is the problem you are experiencing?

---

<div class="post-metadata">

**Author:** ![HEIDARZ](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/d9b06d/32.png) [@HEIDARZ](https://forum.dynare.org/u/HEIDARZ)\
**Post date:** [30 June 2020 12:46 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/34 "2020-06-30T12:46:00Z")

</div>

I added log of some variables and hp filter command to the code but the values ​​of mean for some of them is not zero.What’s wrong with the code?  
thanks  
[nkcc.mod](https://forum.dynare.org/uploads/short-url/9mS2vgZfKqVApIGlPVMU0wlxdIT.mod) (8.3 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:** [1 July 2020 11:05 UTC](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314/35 "2020-07-01T11:05:52Z")

</div>

The mean reported by Dynare is for the unfiltered variables. For the filtered ones, it is trivially 0.

[Previous page](https://forum.dynare.org/t/comparing-model-with-data-after-log-linearization/4314.md?page=1)
