# Specifying observation equations for non-linear models

Hi Dynare team

I am trying to estimate a nonlinear model in Dynare with a mix of filtered and unfiltered data. I read Johannes’ excellent guide of specifying observation equations, and I just wanted to clarify that I’ve specified the equations correctly.

I have the following data:
R_{t}^{obs} : gross nominal interest rate (quarterly) (unfiltered)
\Pi_{t}^{obs} : gross nominal inflation rate (quarterly) (unfiltered)
e_{t}^{obs} : log differences of the real exchange rate (demeaned)
r_{t}^{k,obs} : net rate of return on capital (quarterly) (unfiltered)

Currently, in my Dynare code I have the following observation equations:

``````R_obs = R;
Pi_obs = Pi;
rk_obs = rk + log(Rk_bar);
``````

Where R, \Pi, and e are entered in the other model equations using exp() transformations, and where rk is left as-is.

I am a bit unsure if I have specified the return on capital observation equation correctly. The way it is now, I would have to use Dynare to estimate Rk_bar, as rk is basically – using common notation – “rk_hat”.

1. Why are you matching an empirical log difference of the exchange rate to a percentage deviation from steady state?
2. If you use an exp()-transformation, then your variables will be in logs. This will turn a gross rate into a net one. So you are matching net rates in the model to gross rates in the data.
3. You did not explicitly say what `rk` is in the model. If it’s a log deviation of the gross return on capital from steady state, then adding back the log steady state will result in the net return on capital as observed in the data.

Thanks for the response, Johannes.

So if I understand you correctly, my measurement equations should be:

``````lnR_obs = R;
lnPi_obs = Pi;
e_obs = e - e(-1);
rk_obs = rk;
``````

where `lnR_obs` and `lnPi_obs` is the logged nominal gross interest rate and inflation in the data, respectively.
`rk`, is not in logs in the model and is simply the net return/rental rate of capital.

As for e_{t}^{obs}, since the data is log differences of the real exchange rate, then I would have to specify the measurement equation as `e-e(-1)`. However, I’m not sure if this is doable as I couldn’t find an example in your paper. Have I assumed the timing convention correctly?

1. Yes, the one for the exchange rate looks correct.
2. If `rk` contains the mean, it is also correct.

Thanks you Johannes.

I’m now in the process of estimating the model but I’m getting a “posterior kernel optimisation problem”. I’m not quite sure how to proceed. Would you mind taking a look at the mod file?

ABK_estimation_params.mat (186 Bytes) ABK_estimation.mod (27.8 KB) data_stderr_params.mat (869 Bytes) obs_data.mat (65.3 KB)

Try ABK_estimation_mode.mat (1.4 KB) ABK_estimation.mod (27.9 KB)
You will see that `zeta` runs into an upper bound. You need to understand why that is the case.

`zeta` (or any other parameter for that matter) running into an upper bound can cause a negative Hessian matrix error?

The condition for the Hessian is for an interior maximum. It does not hold at corners. You can see in the mode_file that the entries related to `zeta` are NaN.

Ah! Good point. Thanks Johannes.

Hi, I post here because I don’t think a new thread is deserved.

I have to perform nonlinear estimation. In such a case should I demean my data on the inflation rate as to be consistent with the steady state of the model (0 inflation) or the ergodic mean of the model (which I find to be non-negligibly negative)?

Has anyone ever treated the data to be consistent with the ergodic mean?

It depends, but usually, I would not demean the inflation rate in this case as the mean will be informative.

Hi!

I post here because my question really fits the title of this Topic.
I’m trying to estimate a model with a trend, where the model is written in exp() form (that is, a Nonlinear Model for Log-Linearization in the wording of Pfeifer (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”).

I would like to first estimate the model using the same dataset by Smets and Wouters (2007), and I got somewhat confused about matching the model-implied to the observed variables, and the scaling-by-100 issue. I was wondering if, after dividing their observables by 100, the following measurement equations are correct:

``````dy = Y - Y(-1) + g_c;
dc = C - C(-1) + g_c;
dinve = I - I(-1) + g_c;
dw = W - W(-1) + g_c;
pinfobs = pi_c;
robs =    i;
labobs = L;

``````

where `Y`, `C`, `I`, and `W` are detrended variables, and `g_c` is the economy’s growth rate. All variables enter the model equilibrium conditions with the `exp()` transformation.
I have also taken the same priors as Smets and Wouters (2007) and rescaled the prior of the shocks’ standard deviations by dividing them by 100. Is this correct?

How should I instead proceed if I wanted to use the original dataset and priors (w/o dividing by 100)? Could I simply multiply the endogenous variables (except for `g_c`) by 100 in the observation equations? Or am I completely off-track?

Thanks for any indication!

In that case, you should be observing 100 times to growth rate of the model variables, e.g.

``````dy = 100*(Y - Y(-1) + g_c);
``````