# Measurement equations

**URL:** <https://forum.dynare.org/t/measurement-equations/18691>\
**Category:** General DSGE Modeling\
**Created:** [12 August 2021 18:00 UTC](https://forum.dynare.org/t/measurement-equations/18691 "2021-08-12T18:00:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartinK](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@MartinK](https://forum.dynare.org/u/MartinK)\
**Post date:** [12 August 2021 18:00 UTC](https://forum.dynare.org/t/measurement-equations/18691/1 "2021-08-12T18:00:44Z")

</div>

Dear all,

I am having trouble with understanding the measurement equations in Justiniano and Preston model.  
I have found a mod file used in Rubaszek and Kolasa (2018) who worked with J&P model variants in their paper.

The J&P model is a log-linearised model with variables expressed as deviations from their steady states. This concept is pretty clear to me. As for the data, I would normally take the log of each variable and detrend it (e.g. one-sided HP filter). Thus, SS of all variables is 0 and I can directly match the data with the variables in the model as following (I will only refer to output for simplicity): **y\_obs = y**

The problem is that Rubsazek and Kolasa used the following measurement equation for output (and similarly for other variables): **100\*log(1+y\_obs/100) = y-y(-1) + mu\_y**.  
The output data enter the model as (log(Yt) - log(Yt-1))\*100.

**1)** I don’t understand why there is this type of transformation on the left side. The transformed data is nearly the same as the original data. Why did they use it?

**2)**  
**a)** They didn’t detrend or demean the data prior to estimation so I assume the **mu\_y** should reflect the trend/steady state of the variable. The transformation of their output data was (log(Yt) - log(Yt-1))\*100, thus growth rates. So they used the term **mu\_y** to get rid of the trend, is that right?

**b)** However, there are two things I don’t understand. Why did they inicialize the **mu\_y = 0** and why they assumed **mu\_y, uniform\_pdf, 0, 0.5, 0, 10** in the estimated\_params block. For example, Smets and Wouters (2007) did similar thing (I think) regarding the measurement equations but they certainly did not pressume the mean of 0 and a uniform pdf. It seems a bit odd to me.

**c)** Also, if I demean the data prior to estimation, delete the **mu\_y** term from the model and estimate it as _model(linear)_, do I get the same results?

**3)** In general, I think I don’t understand the usage of the gap data and growth rates data in this model. I would assume that since the model is a log-linear model built in a way that variables reflect the deviations from their SS, thus their cyclical parts, why are the approx. growth rates used? Log difference transformation and detrended data (e.g. via HP filter) are two different concepts giving diffent results. Please, could you explain it to me?

In the original paper Justiniano and Preston (2004), they used a log deviation from a linear trend for output so why Rubaszek and Kolasa (2018) used different approach - growth rates for nearly the same model (only extended a little bit)?

_I attach the exact .mod file that Rubaszek and Kolasa used in their paper._

Thank you very much for any help.

Martin

[jpd.mod](https://forum.dynare.org/uploads/short-url/nMKwSkPT4mFUcPw47aoY0eTdOe.mod) (6.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:** [13 August 2021 08:52 UTC](https://forum.dynare.org/t/measurement-equations/18691/2 "2021-08-13T08:52:32Z")

</div>

Have a look at Pfeifer (2013): “[A Guide to Specifying Observation Equations for the Estimation of DSGE Models](https://drive.google.com/file/d/1r89OU5OE3CBa6tOlj6l3hNVWEaRH5Anv/view?usp=sharing)".  
This is a model estimated with growth rates where the mean growth rate `mu_y` is left in the data.

1. The transformation on the left looks useless as in a first order approximated model \ln(1+x)\approx x so the left simplifies to `y_obs`
2. a. Yes, `mu_y` is the average growth rate.  
b. With a uniform distribution, the mean has no particular meaning. It does not impose any prior information on the data.  
c. No, you will not get exactly the same, because there will be a loss in efficiency is the mean is not jointly estimated with the rest of the model. However, usually the difference is negligible.
3. It’s a matter of preference which filter to use. But as long as the filter in the model and the data is consistent (first differences in this case), it is fine.

---

<div class="post-metadata">

**Author:** ![MartinK](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@MartinK](https://forum.dynare.org/u/MartinK)\
**Post date:** [20 August 2021 08:07 UTC](https://forum.dynare.org/t/measurement-equations/18691/3 "2021-08-20T08:07:31Z")

</div>

Dear Professor Pfeifer,

Thank you very much for your answer. I would like to follow up with one question. I am trying to estimate the models according to Rubsazek and Kolasa (2018), starting with the simple closed NK variant of the full model. However, I am having troubles with the estimation. Please, do you have any idea what is wrong with this .mod file?

Please, find attached the .mod file, error message and the data.  
[jp\_nk\_rkdata.mod](https://forum.dynare.org/uploads/short-url/bDvCvvKmgfEnKWMl8qNt2nWcZ1r.mod) (3.1 KB)  
[data\_est\_rk.mat](https://forum.dynare.org/uploads/short-url/pTbQwP2064oXalyv1iCY3AvBXWl.mat) (6.1 KB)  
[jp\_nk\_rkdata.log](https://forum.dynare.org/uploads/short-url/lOjcm6xatf3fizqLFYZj0x6aTxD.log) (30.1 KB)

The data are transformed according to Rubsazek and Kolasa (2018):

- **y\_obs** is in log differences: [ln(Yt+1) - ln(Yt)]\*100
- **pi\_obs** the same: [ln(HICPt+1) - ln(HICPt)]\*100
- **ir\_obs** : 100\*ln(1+(IR/100))

Thank you very much for any help.

Martin

---

<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 August 2021 11:38 UTC](https://forum.dynare.org/t/measurement-equations/18691/4 "2021-08-20T11:38:56Z")

</div>

One part of the problem is the bug at [estimation: remove invalid check for presence of constant (!1916) · Merge requests · Dynare / dynare · GitLab](https://git.dynare.org/Dynare/dynare/-/merge_requests/1916)  
You can avoid it by using non-zero initial values for the mu-parameters  
[jp\_nk\_rkdata.mod](https://forum.dynare.org/uploads/short-url/wezGl9j4rF1c4s3RD5R1S0Nuqz.mod) (3.2 KB)

The big problem that remains is the scaling of `ir_obs`. It has a mean of 3.5 while you at most allow for something less than 1. I widened the prior and define mu\_i as the quarterly growth rate. Then it works.

---

<div class="post-metadata">

**Author:** ![MartinK](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@MartinK](https://forum.dynare.org/u/MartinK)\
**Post date:** [20 August 2021 13:26 UTC](https://forum.dynare.org/t/measurement-equations/18691/5 "2021-08-20T13:26:11Z")

</div>

Dear Professor,

That’s great, thank you! I really appreciate your help.

I would like to kindly ask you one last question. Since I know where the problem was with the closed variant and its estimation, I tried to estimate the open variant. Based on your advice, I modified the model but I couldn’t estimate it. I have no experience with models which include VAR so if you could help me with this, I would be really grateful.

Please, find attached the .mod file, the data and the log.  
[jp\_var\_rkdata.mod](https://forum.dynare.org/uploads/short-url/mWkL8926g2z3t538JdesgF27JRU.mod) (8.6 KB)  
[data\_est\_rk.mat](https://forum.dynare.org/uploads/short-url/pTbQwP2064oXalyv1iCY3AvBXWl.mat) (6.1 KB)  
[jp\_var\_rkdata.log](https://forum.dynare.org/uploads/short-url/4VtyhxZFEAJT10u4YRfSSMVv4iG.log) (21.2 KB)

Thank you in advance!

Martin

---

<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 August 2021 13:51 UTC](https://forum.dynare.org/t/measurement-equations/18691/6 "2021-08-20T13:51:10Z")

</div>

The following works. Again, your prior was inconsistent with what was needed for the observables. I did not check, but are you sure that for example `ca` is measured correctly?  
[jp\_var\_rkdata.mod](https://forum.dynare.org/uploads/short-url/gnenkXqII15GSNlUyPPCoIukR9b.mod) (8.6 KB)  
[jp\_var\_rkdata\_mode.mat](https://forum.dynare.org/uploads/short-url/1fWnjBPTYtVuV2vI1DuvIuoVsZ0.mat) (45.0 KB)
