# Estimating nonzero covariances for exogenous shocks

**URL:** <https://forum.dynare.org/t/estimating-nonzero-covariances-for-exogenous-shocks/3657>\
**Category:** Dynare contributions and examples\
**Created:** [29 January 2014 20:36 UTC](https://forum.dynare.org/t/estimating-nonzero-covariances-for-exogenous-shocks/3657 "2014-01-29T20:36:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdmorris](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@sdmorris](https://forum.dynare.org/u/sdmorris)\
**Post date:** [29 January 2014 20:36 UTC](https://forum.dynare.org/t/estimating-nonzero-covariances-for-exogenous-shocks/3657/1 "2014-01-29T20:36:29Z")

</div>

…Produces an error message. I had this problem, figured out how to get around it, and thought others might find useful. Attached.  
[note.pdf](https://forum.dynare.org/uploads/default/original/2X/8/89bbe45c0e075794f6ccb6e961dfb448e265b0f7.pdf) (136 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [30 January 2014 07:24 UTC](https://forum.dynare.org/t/estimating-nonzero-covariances-for-exogenous-shocks/3657/2 "2014-01-30T07:24:02Z")

</div>

What you do is completely unnecessary. You are just not using the correct syntax. The shocks-block is for calibration. You cannot put estimated parameters in the shocks-block as this block will not be used for updating the covariance matrix during estimation. What you describe should also occur for a diagonal covariance matrix when you are trying to estimate a parameter that sets the variance in the shocks-block.

The correct way is using the estimated\_params-block, which is for estimation. To estimate a correlation between two shocks as in your example, you use something along the lines of

`estimated_params;
stderr ez, inv_gamma_pdf, 0.01, inf;
stderr eg, inv_gamma_pdf, 0.01, inf;
corr ez, eg, normal_pdf, 0, 0.1;
end;`  
You do not need to specify a separate parameter for the off-diagonal elements. Dynare directly estimates them as it does with variances.

---

<div class="post-metadata">

**Author:** ![sdmorris](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@sdmorris](https://forum.dynare.org/u/sdmorris)\
**Post date:** [30 January 2014 18:40 UTC](https://forum.dynare.org/t/estimating-nonzero-covariances-for-exogenous-shocks/3657/3 "2014-01-30T18:40:05Z")

</div>

jpfeifer, thanks; I couldn’t find this much easier solution anywhere online previously.
