Measurement equations for log-linearized modelse

Hello everyone,

as many of you, I have a problem to transform the data right to match the model variables. After reading the posts in the forum and " A Guide to Specifying […]" I still have a mistake in my data.

I have to match the data to the model variables (output, inflation and interest rate) of a log-linearized model and this is what I have done to detrend and demean the data:


real GDP/capita = GDP Chained 2009 Dollars, Seasonally Adjusted /CLF16OV
taking log difference*100: (ln(rGDP_t)-ln(rGDP_t-1))100 in order to detrend it
and demeaned it: 100

interest rate:

Federal Funds Rate, Percent
expressed it in gross rates: r=1+FEDFUNDS/100
since the interest rate does not have a trend, i have taken logs scaled by 100:
100ln( r) and demeaned it: 100ln( r)-mean


Consumer Price Index, Index 1982-1984=100, Seasonally Adjusted
to get the gross rate I scaled it as follows: 1+CPI/100
as with output, i detrended by the log difference and scaled it by 100:
and demeaned it, so that 100

my observation equations are as follows:


could someone check, what I am doing wrong ?

Thank you !!

GDP_CPI_FFR.xlsx (82.9 KB)

But why are your data in the Excel file not mean 0 if you demeaned them after transformations?

Dear Professor,

that was a mistake on my behave. I have corrected it.
But I still don’t get a mean of 0 for observables:

Mean dy= -0.001580706
mean robs= -0.026078268
mean CPIobs= -0.002399116

I have calculated the mean for GDP and CPI by

and for the interest rate by
Sum(100*ln( r))/nobs

Could there be a mistake in the transformation before demeaning?

newdatafile.xlsx (80.2 KB)

Are you demeaning on a different sample? There cannot be a mistake before demeaning. The name demeaning already says it all. Regardless of what you did before, you subtract the mean.

Dear Professor,

I’m very sorry to bother you with this but I’m puzzled.

I thought since we take the first difference of GDP and CPI, we would lose one observation.
e.g. originally we have 200 observations, after taking the first difference we have 199 observations, resulting in Sum(100ln(X_t)-ln(X_t-1))/199.
Could that have been the mistake? When I divide Sum(100
ln(X_t)-ln(X_t-1))/200, the mean of the transformed data GDP and CPI is 0.0000000.

However, because we do not take the first difference from the interest rate, I have calculated the mean by Sum(100*ln( r))/200, still resulting in a mean of the transformed data of -0.02608.

And of course, I’m still getting error messages.
I don’t understand, what I’m doing wrong.

newdatafile.xlsx (80.2 KB)

I still don’t understand what you are doing. You are supposed to demean the 199 observation after computing growth rates.

Hello Professor,

I have done the whole data transformation all over again. I’m not aware of having done anything different. However, now the data have a mean of 0.

The problem is that I’m still getting error messages when I’m running the estimation with the new data file. I’ve tried mode compute 4 and mode compute 5.

Could it be, that the data are still not transformed correctly ?

file.xlsx (76.9 KB)

Please provide the full files to run estimation.

Of course, I’m sorry. (76.1 KB)

If you run
you will see that various parameters are not identified.

Hello Professor,

yes, I see. Is there a way to fix this?
I have read in the forum posts that it would be advisable to increase the number of observables, but I don’t have more oberservables in this simple setting of the model. Could something else solve this issue?

Part of the problem stems from well-known identification issues in the NK model estimated on demeaned data. There is nothing you can do about it except for fixing some of the parameters and/or including data means.

Should I add initial values, LB, UB or how can I fix the parameters ?

Including data means by adding the mean to the observed data and adjust the measurement equations by adding the mean to the model variables ?

  1. Now, simply don’t estimate beta and eta.
  2. Yes. beta for example will govern the mean real interest rate.

Hello Professor,

I have added:

betta, 0.9975;
eta, 2;

before the estimation command and removed beta and eta from the estimated_params command.
Even though I get the message

Parameter betta is not estimated (the value provided in estimated_params_init is not used).
Parameter eta is not estimated (the value provided in estimated_params_init is not used).

I still get an error. When I keep both parameters in estimated_params as it was done in Sims (2014), it still doesn’t work. (76.0 KB)

You are having trouble of finding an interior solution. Try
SimpleDSGE.mod (2.4 KB)

I have done the whole data transformation all over again. I’m not aware of having done anything different. However, now the data have a mean of 0.

Hello Professor Pfeifer,

thank you very much for your help. Now it works perfectly fine. I have also noticed that you have adjusted several things in my codes, so thanks a lot for that.
I have one last question. When extending the model, I had to calibrate even more parameters. Does this result in a bias of the estimation?

Why did you need to fix these parameters?

I’m not aware of having done anything different. However, now the data have a mean of 0.. .