# Colinear equations & variables

Hello,

Full disclosure: I am just getting started with dynare and there are not too many tutorials for beginners out there so please bear with me.

I started writing very simple models myself on top of tweaking models already written by prof. Pfeifer and publicly available on his github. For instance, I tried to use bayesian techniques to estimate some of the parameters of the NK model (chapter 5 & 8).

whereas it worked just fine estimating phi_pi & phi_y “bayesianally” in the simple rules vs committment implementation of prof. Pfeifer, the more advanced open economy NK model runs into Blanchard & Khan indeterminancy (colinear variables & equations).

Colinear variables:
w
p_h
p
er
Relation 2
Colinear variables:
w
p_h
p
er
Relation 1
Colinear equations
2 4 9 12 13 14 24 25 26 29
Relation 2
Colinear equations
2 4 9 12 13 14 24 25 26 29

I just assume that the issue with w and p comes from the fact that they only appear once in the model as “w-p” and dynare cannot compute FOC. Regarding p_h and er I can’t really tell…

Some tips on how to start with dynare and how to ‘debug’ issues like these would be very helpful…

Thank you

Ok…all I had to do was input ‘difuse_filter’ and B&K conditions were met…

Hello again,

I’ve encountered the following issues by running prof. Pfeifer’s implementation of Gali chapter 8. I did not change any lines describing the model or added/remove any parameters, besides adding an ‘estimated_params’ block and an ‘estimation’ line as to estimate the coefficients in a bayesian manner.

I. Bayesian estimation of model parameters (reading from an XLS file)

As soon as I take more than 3 variable as observable (i.e. also there are 3 shocks implemented: technology, monetary and preference), the following error pops up:

• mode_compute = 6
initial_estimation_checks:: Estimation can’t take place because there are less declared shocks than
observed variables!

• mode_compute = 1,2,3,4,5,7…
initial_estimation_checks:: Estimation can’t take place because too many shocks have been calibrated with a zero variance!

As a result, I cannot take more than 3 inputs in a given run. Is there any workaround? Theoretically, dynare still estimates the parameters, but shouldn’t you be allowed to have as much as input as variables declared?

Also, any mode_compute but mode 6 runs into Error using chol Matrix must be positive definite. Is there any reason why ALL others seem to run into that problem but not this one?

II. Ideal shock size for parameter estimation
The more variables you take as observable, the more spiky the posterior distribution gets (no matter what priors / standard deviation) you’re using if your “shock strength” in the shocks block is something relatively small (i.e: 0.25, 0.5, etc.). If you want to get a more ‘normal-looking’ posterior distribution, the shock must be really big (i.e: >25).

**III. How should one use data as input?
I know that the basic HP-filter in e-views to get output gap is highly discouraged. Also, data such as output should be used under log.
Is there any treatment one should apply to '‘percentage data’ such as inflation / unemployment?

And is this the primary reason (data mishandling) for the matrix not being positively defined and running into a bunch of errors?

Sorry for the long "story "and thank you a lot in advance to whoever may reply.

1. You cannot have more observables than shocks. This would cause stochastic singularity. See Issue with the Kalman filter - #2 by jpfeifer
2. Without the full codes, it is impossible to tell why the Hessian is not positive definite. Often the `mode_check`-plots provide an indication.
3. The problem with the shock size suggests a wrong data-scaling.

Pfeifer_Gali8.zip (21.5 KB)

1. That was what I assumed as well.
2. I have attached the code.
3. I get it - I rechecked, I think it comes from the fact that my output_gap is ‘0.01’’ ~ 1% whereas the others are in percentages. I think this is why.
1. As a rule of thumb… if one wants to estimate the parameters of a given model (and assuming there are less shocks than parameters), how should one proceed? Do you just re-run the model by giving the necessary inputs and estimating the parameters iteratively? (for instance: you feed output gap, inflation => phi_pi / phi_y, then you feed the model some data regarding unemployment => n from the model).

I know it probably sounds a bit absurd, but this is my first try/model and I still figuring out the ins and outs. And thank you for your patience.

A couple of notes:

1. You may want to read Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”. A big issue may be that your inflation and interest rates are still annual while the model is quarterly.
2. You may want to use `prior_trunc` and adjust the prior for output feedback to not have an asymptote at 0.
3. Estimating a model using likelihood based techniques means specifying the full data generating process. You settle on a particular set of observables and estimate all parameters. Alternatively, you could add measurement error to estimate with more observables. See the reference in 1.