Page 1 of 1

estimating variance structural shock, transforms of stderr

PostPosted: Sat Dec 04, 2010 6:42 am
by jefflovejapan
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:
Code: Select all
#varianceofa=(stderr a)^2;


And then in the estimated_params block:
Code: Select all
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?

to clarify

PostPosted: Sat Dec 11, 2010 4:17 am
by jefflovejapan
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.

Re: estimating variance structural shock, transforms of stderr

PostPosted: Sat Dec 11, 2010 7:30 am
by jpfeifer
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
Code: Select all
...+sqrt(varianceepsilon)*epsilon

Then set the stderr of epsilon to 1:
Code: Select all
var epsilon; stderr 1;

Remember var(sqrt(varianceepsilon)*epsilon)=varianceepsilon*1. Now you do not estimate the standard deviation as usually, but rather estimate varianceepsilon, i.e. you omitt the
Code: Select all
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
Code: Select all
varianceepsilon, 0.7, , , inv_gamma_pdf, 0.5, 0.15;

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

Brilliant

PostPosted: Sat Dec 11, 2010 8:23 am
by jefflovejapan
Thank you very much!