# Input Data (Bayesian estimation)

My question is related to Gali chapter 8 (implemented by prof. Pfeifer) and the accurate way to read data from a file.

On github, you mentioned that all variables are in log-deviations from the steady state, but interest rate which is mean 0.

After reading the guide on observable variables, I proceeded the following way:

• GDP (real quarterly volumes) → log(gdp) → get cylical component using univariate-HP filter
Read it from the file like: y_obs = yhat or y_obs = y_gap

• Nominal interest rate (net annual percentages) → make it quarterly percentages ln(1 + rate/400) → get cyclical component using univariate-HP filter
Read it from the file like: i_obs = i

• Inflation Rate (net quarterly percentages) → get cyclical component using univariate-HP filter
Read it from the file like: pi_obs = pi

Question 1: You mentioned that interest rate is mean 0, not in log-deviations from steady state. HP-filter also demeans the data and the cyclical component is mean 0. Nonetheless, shouldn’t there be a difference between the way you match output gap and how you match inflation / interest rate given one is mean 0 and the others in log-deviations?

Question 2: Given that all variables (but the abovementioned ones) are in log-deviations, is it appropriate to just detrend variables (log consumption per capita, log NX per capita) using univariate HP filter and consider the cyclical component as log-deviation from steady state and read it like c_obs = c & c_NX = NX plus some shock to avoid stochastic singularity?

Question 3: Is it ok to just take the log difference of variables such as nominal exchange and read it like er_obs = er - er(-1) + eps_er. I don’t understand why this is appropriate…I saw a lot of posts where people read variables like this, but I did not really understand why - er in the model is log deviation from steady state while er_obs is basically log difference of nominal rates → growth rate. How do these two match?

Thank you

1. I don’t understand the question. A log deviation from steady state is mean 0.
2. Yes, you can do that, because you simply take out your concept of a trend.
3. A log deviation from steady state is \hat x_t= log(x_t)-log(\bar x). Thus, the steady state part drops out in the difference:
\hat x_t-\hat x_{t-1}= log(x_t)-log(\bar x)-(log(x_{t-})-log(\bar x))=log(x_t)-(log(x_{t-})
4. What do you mean with univariate HP-filter? The one-sided HP filter?
1. On github, you mentioned nominal interest rate separately from the other variables (as being in mean 0 rather than log-levels). I thought I had to read it from a file in a different way: interest rate and natural output are not in log-levels, but rather mean 0
I did not understand the meaning of that statement and I got confused a bit.

i_obs = cyclical component [ ln(1 + rate/400) ] //so basically read it like this and I assume it is correct

pi_obs = cyclical component [pi ] //pi was already net quarterly percentages so I straight got the cyclical component without any other processing

My question was related to the treatment of these two variables and if I should have matched them differently as I did read them the same from the file

i_obs = i
pi_obs = pi
Basically, matched them both exactly to model variables

2. Ok, so basically, you can take the cyclical component of any variable and match it exactly to an existing variable if I understood correctly (obs_variable = model_variable + shock) where the observable variable is the cyclical component using a one-sided filter. Maybe I’ve missed in the guide, but is there a suggested way to tackle variables that can be negative such as NX and you cannot take the log of?

3. Ok - basically obs_variable = model_variable - model_variable(-1) + shock, where I take the log difference of my observable

4. Yes, one-sided HP filter (hpfilter1s from eviews more precisely)

Thank you

One follow-up question regarding your guide

If you take the log difference of your data (non-zero mean) and then demean it (now zero mean), do you match it like this?

XLS File:
obs_variable = log(obs_variabile_volume) - log(obs_variable_volume-1) => growth rates ~ 0.01 mean ~so around 1% mean which does not match the model variable which is mean 0

=> I demean it like: log(obs_variabile_volume) - log(obs_variable_volume-1) - average(log(obs_variabile_volume) - log(obs_variable_volume-1))

Dynare:
obs_variable = model_variable - model_variable(-1)

Or how do you specify you demeaned the data in log differences eXplictly when you read from the file? My guess you do not have to, as you match demeaned log-differences which is 0 mean which is already the variable in the model.

I think I solved it myself (hopefully).

If you use one-sided HP filter or you demean the data in log-difference is the same and in both situations, you can match data like:

obs_variable = model_variable + measurement_error

P.S: The only thing is…what if the data in log differences is mean 0… demeaning it seems meaningless.

1. The statement is about the comparison to the book. Gali uses the log level of the interest rate, not the percentage deviation from steady state.
2. I don’t get where a shock will come from in your equation unless you assume measurement error. Regarding net exports, a typical way is to use the net export share as an observable instead of log net exports.
3. Yes, you would match demeaned first differences, where you use