Estimating variance structural shock, transforms of stderr

In Dynare you can use stderr VARIABLE_NAME to estimate the standard error of a variable, but is it possible to estimate its variance directly (i.e., estimate its posterior distribution)? In an (unfinished) 2007 paper titled “Prior Distributions in Dynare”, Stephane Adjemian writes, “Note that if someone wishes to use an inverted gamma distribution as a prior, then he should use the INV_GAMMA2_PDF word in the estimated_params block. This distribution is often used as a prior for the variance of a structural shock or measurement error.”

Is it possible to estimate the variance of a variable directly, either through estimating a transform of stderr, or through some other means? I was hoping to do this, for the exogenous variable a - the stochastic component of an AR(1) process:

In the model block:

#varianceofa=(stderr a)^2;

And then in the estimated_params block:

varianceofa, inv_gamma2_pdf, 0.5, 0.15;

But it doesn’t seem to be possible to refer to stderr in the model block. Is it possible to do this or something like it in Dynare?

How does one go about estimating the variance of a shock instead of its standard error in dynare? From Stephane’s paper it seems that this is possible to do in Dynare, but there’s no mention of it on the site or in the manual or user’s guide.

You have a shock called epsilon and you want to estimate its variance called varianceepsilon, which you initialize as a parameter. Now redefine the shock by entering it everywhere in the equation as


Then set the stderr of epsilon to 1:

var epsilon; stderr 1;

Remember var(sqrt(varianceepsilon)epsilon)=varianceepsilon1. Now you do not estimate the standard deviation as usually, but rather estimate varianceepsilon, i.e. you omitt the

var epsilon, inv_gamma_pdf, 0.5, 0.15;

from the estimated_params block as you want to keep it at 1, but simply add

varianceepsilon, 0.7, , , inv_gamma_pdf, 0.5, 0.15;

of course with the correct prior mean and variance for your parameter.

Thank you very much!

Sorry for bringing up this post again, but unfortunately I can’t see your expressions between the text (just a gray line with no content). So I wanted to ask if you could rewrite this answer so I can see it?

I would be very grateful!

Thanks for pointing this out. This happened during the migration to Discourse. I fixed the post.