Question about bayesian estimation

Dear all,
I would like to ask several problems about bayesian estimation . The first problem is whether Bayesian estimation is sensitive to the value of parameters. Because a certain value of parameter, bayesian estimation can be carried out. However, if we change a little of value of parameter, Bayesian estimation can not be carried out. and it shows ‘ Matrix must be positive definite. ’.
The second problem is about the data of bayesian estimation. For example,I have data on output and investment. When I was brought it into the model separately,the model can run. But when I use both of them at the same time, it also shows ‘ Matrix must be positive definite. ’.
I don’t understand why this happens. Is that normal? I hope I clarify my question,can anyone answer my doubts? Thank you.

For example,in lowrisk.mod, Reciprocal elasticity of labor supply elasticity gamma equal to 0.4, lowrisk.mod can be able to run , however when gamma equal to 0.5, lowrisk.mod cannot be able to run.
I am really puzzled. Is this a common problem?Or is there any problem with my model?
data.xls (33 KB)
lowrisk.mod (5.7 KB)

You are not handling parameter dependence correctly. Search the forum on this issue.

jpfeifer, I have searched for the forum and looked ‘A Guide to Specifying Observation Equations for the Estimation of DSGE Models’. I change model-local variable using the #-operator in the model-block.

But it showed ‘ERROR: lowrisk.mod: line 130, cols 1-18: r_ss has wrong type or was already used on the right-hand side. You cannot use it on the left-hand side of a pound (’#’) expression’.

Did I make a mistake in some place? What am I missing?
data.xls (33 KB)
lowrisk.mod (5.9 KB)

If something is a model-local variable, you cannot define it as a parameter.

jpfeifer, Thank you very much. The problem was solved.

I want to ask another question about the using data of bayesian estimation. If I use different data in the same model ,for example, using output data at a time, using output, investment and interest data at another time. Is there any possibility of great difference for impulse response diagram and variance decomposition ?

Yes, what you match does matter. See e.g.

jpfeifer,after finished reading this article, I got some gains.Now I have new questions during Bayesian estimation, I hope to get your answers.
First,the prior of parameters is very important for Bayesian estimation,Incorrect settings often cause Bayesian estimation to fail to run. And even prior distribution or variance lead to different results. I don’t know if this is right?
Second, the estimation or non estimation of a parameter, for example elasticity of capital output “alpha”, will it be possible affect the numerical value of variance decomposition?
Third,are the distribution types of the parameters fixed? Can I set shape of prior distribution according to whether it can run or not?
Thank you in advance.


  1. I do not know what is an incorrect prior. It’s a personal matter (your belief about a parameter). That said, it is true that if your prior is completely at odds with the likelihood, this can complicate things in a way you may not want (for instance creating multi-modal posterior distribution, even if the likelihood is unimodal).

  2. I am not sure I understand this one… The value of \alpha will most likely affect the variance decomposition since it affects the transition dynamics (not only the steady state). It’s up to you to decide if you want to estimate this parameter (the alternative being calibration).

  3. I most likely do not understand this one… The prior is fixed. You choose a prior shape (Gaussian, Beta, …) and prior moments (expectation and variance) to characterize your prior beliefs about parameters. This is not supposed to change during the estimation process. Some approaches, not implemented in Dynare, estimate the hyper-parameters of the prior (indirectly the prior expectations and variance), but I do not know if this is what you have in mind here.


Stéphane,thank you for your answer. I will supplement my question in more detail.
1.I feel the prior variance affect whether Bayesian estimation is carried out. For example,when I set some parameter variance equal to 0.2,Bayesian estimation is not carried out. While when I set some parameter variance equal to 0.1,Bayesian estimation is carried out. Is it right?

2.I do not know α affects the transition dynamics. I tried to estimate other parameters during Bayesian estimation. One parameter whether is it estimated (for example, labor substitution elasticity, consume substitution elasticity etc) affects variance decomposition. I’m not sure if this is right?

3.I’m sorry not to illustrate the problem. Take the inflation response coefficient of monetary policy as an example, in some articles its prior shape is set as normal_pdf, while in other articles its prior shape is set as gamma_pdf. I would like to ask whether there is a uniform standard for setting prior shape? Will it affect the estimation results of parameters?

4.I want to ask one more question. When I use output, investment and inflation data.Bayesian estimation is carried out. While I use output data separately,occasionally Bayesian estimation is not carried out. I really don’t understand why.Will it happen?Why?
Thank you in advance.


  1. Thanks to the Bayes theorem, we now that the posterior density is proportional to the likelihood times the prior density. The prior density can be interpreted as a device (a weighting function) that deforms the likelihood (this quite useful if the likelihood is flat). So obviously the inference will depend on your choice for the prior. This is illustrated in these slides.

  2. It is to be expected that the values of the parameters affect the various moments of the endogenous variables you can compute from the model. If the moments were not influenced by these parameters it would mean that you do not need them (you do not need to use CES production functions in your model if the elasticity of substitution between inputs has zero impact on the moments).

  3. The normal prior is not well suited for the parameter before inflation in the Taylor rule. Theory shows that this parameter has to be greater than one (in a lot of models). So a prior defined between -\infty and +\infty makes no sense, since we put a positive prior probability mass in a region where we cannot go (Dynare automatically excludes set of parameters that leads to indeterminacy). A shifted gamma prior makes much more sense in this case.

  4. The inference depends on the prior… But also on the data! If you consider only one observed variable, you have much less information to identify the same number of parameters… This may be a problem. In some case it will be even impossible to obtain sensible results.


Stéphane. thank you for your detailed answer.