Simple RBC model setup error for bayesian estimation

I think there is a problem in the way I am defining measurement equations / observation equations. I went through the posts and also the paper on observation equations and the variables viz., gdp and consumption are defined as dy = y-y(-1); dc = c-c(-1)

But can you tell me why there should be a unit root in all variables?

I think there is a problem in the way I am defining measurement equations / observation equations. I went through the posts and also the paper on observation equations and the variables viz., gdp and consumption are defined as dy = y-y(-1); dc = c-c(-1)

No, it’s not about the measurement equations. It’s about the real variables having a unit root.

So in log-linearized model, y is basically- ln(y/yss), pi is log(pi/pi_ss), so on and so forth- log deviations from steady states. Major part of the model is adaptation of Monacelli (2005). If we are talking about unit root in real variables that means most variables are evolving through a unit root process - inflation in open economy models generally has a unit root if I am correct

It means that after a shock, y will not return back to steady state. That is highly unusual in models. Also, it’s usually the price level, not inflation, which has a unit root.

That helps Thank you. I think the only way is to re-check the model. So theoritically speaking how can we check for unit roots in models before even we calibrate the model? How can this be detected. I need to understand it before I can look for problems and mend the model.

You can have a look at the theoretical moments (periods=0). If the variance is NaN, the variable is non-stationary due to a unit root.

Thank you Prof. Pfeifer, I made some changes to the model. Attached is the revised file, it works fine now.

  1. But I wanted to know how can I run identification tests with some non-stationary variables in the model.
  2. Also, if I have quarterly data which has already been demeaned and detrended, is the way I map them correct?
  3. Your feedback on the estimation would be helpful with the revised model.
    Monetary_model_v13.mod (7.0 KB)

When I try with logged detrended quarterly data for all variables and one way hp filter for GDPs, it throws following error:

Error using chol
Matrix must be positive definite.

Your observables still have a unit root.

Yes, some of the observables do.But I checked with the authors as well and they said that the model equations in the paper give absolutely stable results. Is there a way to deal with non-stationarity? What do you suggest. i have checked my model equations multiple times.

Also, about identification? How can I check that

  1. You cannot check identification with nonstationary observables. All second moments do not exist.
  2. If the authors say the model is stationary but your implementation is not, there must be a mistake in your codes.

On 2, I have mapped the equations exactly as they exist in the paper. And I have cross-checked them multiple times. There does not seem to be an error in that. I am not sure where I can go from here? I have mde some revisions further and attached is revised file.

Monetary_model_v16 (1).mod (7.0 KB)

Also, authors confirmed they worked final estimations with real exchange rates and inflation rates. Also, the observables are percentage gaps.For example, output gap is HP filter defined by subtracting the low frequency filtered series from the actual (log-transformed) data.

I think what they meant to say is that in their MCMC estimation loop, when they searched over the parameter space using standard Metropolis-Hastings, drew a parameter vector and solved the model, if the check returned an unstable or stationary but multiple rational-expectations equilibrium, they discarded that model parametrization and searched again elsewhere in the parameter space.

Is there a way to induce non-stationarity? They also mentioned that we can induce non-stationarity. Which equations do you think might be inducing non-stationarity in the model?The following:

q(+1) - q = (r - pi(+1)) - (r_o - pi_o(+1))+ epsilon_q;
s - s(-1) = pih - pif + epsilon_s;

I made further changes to the model. I had few questions:

  1. if i have quarterly data how do I map it to the model- just mapping as it is y_obs=y since i have quarterly , logged , hp filtered data.?
  2. Also, supoose some variables in the model have unit root , then we can estimate it using diffuse filter. Correct?
  3. If 2 above is correct then how is identification checked?
    4)Further do we need to introduce measurement errors in measurement equations separately?

I re-worked and simplified the model but I still have following questions if you can help.

  1. If I have quarterly data how do I map it to the model- just mapping as it is y_obs=y since i have quarterly , logged , hp filtered data.?
  2. Further do we need to introduce measurement errors in measurement equations separately?
  1. y_obs=y is correct with HP filtered data and a linearized model (although you should not use a two-sided filter).
  2. Normally, you don’t need measurement error.

Thank you Prof. Pfeifer. I reworked the model from scratch and simplified it to see where the errors might be arising from.

Also, for my real business cycle model the model moents do not match data moments. I just use
stoch_simul(order=1,periods=0) command before Estimation but theoretical moments and data second moments viz., Standard Deviation do not match and they are not close. When can this be the case. I might be wrong some where?

Can I simulate model using data- I saw some posts which mentioned command “simult.m”

To compare moments, you need to make sure that the data and model objects correspond, e.g. that you are comparing log deviations from a trend with a similar filtering treatment and did not scale one object by 100 and the other one not.

Thank you Prof. Pfeifer. I tried to check. Still not sure if everything I am doing is correct to compare. There is just one data series I use for estimation. That series is logged and de-trended and I take second moments of that to compare with second moments of simulated and estimated model at period 0. That’s the correct way to do it?

Can you provide the files to see the difference in moments?