I am doing Bayesian estimation and was wondering if DYNARE can give me the estimated Autocorrelation functions (ACF) based on the estimated model. For example, I would like to look at the estimated ACF function for output from the estimated model, together with the 95% confidence interval of the ACF (and then see whether it is close to the ACF of output in the data).

In case it helps, I am attaching the DYNARE estimation code I’m using. Everything runs smoothly. I’m just not sure whether there are some extra options for getting the ACF that I’m missing. I know there is the “ar” option, but it seems you can only use that for simulations of a calibrated, not for estimation.

estimation(datafile=datapullcggjpn,conf_sig =.95,filtered_vars,smoother,first_obs=8,nobs=58,mode_check,mode_compute=1,mh_replic=20000,mh_jscale=0.4,mh_nblocks=1,bayesian_irf,irf=12) pie piestar pie4 r rstar spie sr sx taylor x;

Hi, you have to use the option **moments_varendo** in the **estimation** command to trigger the computation of the posterior moments. Do not forget to list the subset of variables for which you want to compute the posterior moments after the **estimation** command.

Best, Stéphane.

Stephanie:

Many thanks, but it seems that the autocorrelation function is not one of the moments computed (see below). In particular I added the “moments_varendo” to the estimation code, and listed the endogenous variables after the estimation command. But when I ran the estimation code, what DYNARE stored in oo_ was the covariance, correlation, and VarianceDecomposition, not the autocorrelation function (e.g., the estimated correlation of pie with pie(-1), pie(-2), …, pie(-10)).

I may be missing something, and was wondering if you could let me know.

Best,

Daniel

estimation(datafile=datapullcggjpn,conf_sig =.95,filtered_vars,smoother,first_obs=8,nobs=58,mode_check,mode_compute=1,mh_replic=20000,mh_jscale=0.4,mh_nblocks=1,bayesian_irf,irf=12,moments_varendo) pie piestar pie4 r rstar spie sr sx taylor x;

oo_.PosteriorTheoreticalMoments.dsge

ans =

covariance: [1x1 struct]

correlation: [1x1 struct]

VarianceDecomposition: [1x1 struct]

oo_.PosteriorTheoreticalMoments.dsge.correlation

ans =

mean: [1x1 struct]

median: [1x1 struct]

variance: [1x1 struct]

hpdinf: [1x1 struct]

hpdsup: [1x1 struct]

deciles: [1x1 struct]

density: [1x1 struct]

oo_.PosteriorTheoreticalMoments.dsge.correlation.mean

ans =

pie: [1x1 struct]

piestar: [1x1 struct]

pie4: [1x1 struct]

r: [1x1 struct]

rstar: [1x1 struct]

spie: [1x1 struct]

sr: [1x1 struct]

sx: [1x1 struct]

taylor: [1x1 struct]

x: [1x1 struct]

Sorry, you’re right! Dynare does not compute the autocorrelation function (I can’t remember why we do compute the covariance matrix *and* the correlation matrix). I need to write the code for the autocorrelation function… I will try to do this before the end of the month.

Best, Stéphane.

That would be great.

BTW, could a quick fix be to create a number of lagged endogenous variables in the model, and then get the autocorrelations from the correlation matrix? In particular, I could create

L1pie = pie(-1)

L2pie = (pie(-2)

…

and then use correlation ( pie , L1pie ) as the estimate of ACF(1),

correlation ( pie , L2pie ) as the estimate of ACF(2), etc.?

Best,

Daniel

Hi Daniel,

Dynare computes the posterior distribution of the autocorrelation function.

Say X and Y are two endogenous variables.

You will find the posterior mean of the autocorrelation function of X in

`oo_.PosteriorTheoreticalMoments.dsge.correlation.mean.X.X`

which by default is a 5*1 vector. You can change the using the option ar=xx in the **estimation** command. You will find

the posterior mean of the cross-autocorrelation function of X and Y in

`oo_.PosteriorTheoreticalMoments.dsge.correlation.mean.X.Y`

which, again, by default is 5*1 vector.

You can obtain the posterior variance of the autocorrelation function replacing the field mean by variance.

You can obtain the posterior median of the autocorrelation function replacing the field mean by median, etc…

Best, Stéphane.