Estimating Covariances (via ML) in Dynare

Dear Dynare Developers,

I have recently encountered some issues when trying to estimate covariances of the structural shocks of my model.
I use Maximum Likelihood to estimate the standard errors of my two structural shocks and the covariance between
the two.

Below, I attach three files in which I make the point with a standard RBC model with (log) government expenditure and (log)
technology shocks. The file rbc_simul simulates the model by imposing the covariances between the shocks through the usage
of the command “var eps_z,eps_g = number”. The file rbc_estimmodel contains the same model but now imposes the covariance
between shocks through

eps_z = eps_zg + u_z;
eps_g = q12*eps_zg + u_g;

where var eps_zg is set to 1 so that q12 captures the covariance between the shocks. This very model is then used in estimation.
The reason why I introduced this common shock is that Dynare, as far as I understood, is only able to estimate correlations but
not covariances and, thus, if one wants to avoid using the delta-method to get back the correct standard deviations from the
formula which maps correlations to covariances this is the only way to go.
(See also Likelihood only!).

Here are the issues that I would like to discuss with you:

  1. The introduction of a common shock to estimate covariances is not innocuous.
    i) While the policy functions of the rbc_simul and of the rbc_estimmodel are the same (except the almost zero coefficients
    on the common shocks) the simulated paths for output and other observables are not.
    ii) Indeed, output in the rbc_simul model falls in an acceptable range, it has some pathological values in the rbc_estimmodel
    (ranging from -5!! to 10) unless the variance of the common shock is set to zero (in which case we would get the case of
    uncorrelated structural shocks).

  2. The only way to keep output in an acceptable range is to use a specification of the covariances of this type
    eps_z = sqrt(q12)*eps_zg + u_z;
    eps_g = sqrt(q12)*eps_zg + u_g;

but this is clearly unfeasible when your true covariance is negative and still simulated data are different from the ones
in the rbc_simul model. In fact, in the bigger model I use for my paper this specification was the only one which allowed
me to get sensible estimation results (estimated parameters close to the true values, non-pathological mode_check plots,

In sum, my fear is that introducing this common shock to estimate variances is not the right way to go because we are not
actually estimating the right model.

Many thanks in advance and best wishes,
rbc_estim.mod (2.77 KB)
rbc_estimmodel.mod (2.2 KB)
rbc_simul.mod (2.12 KB)

I am not sure I get what you are doing.

  1. Why can’t you estimate a correlation using Dynare’s capabilities and back out the covariance?
  2. If

eps_z = sqrt(q12)*eps_zg + u_z; eps_g = sqrt(q12)*eps_zg + u_g;


var(eps_z)=q12+sig_z^2 var(eps_g)=q12+sig_g^2

[quote]0.0001749 0.0001056
0.0001056 0.0007090

This is clearly not the same as

var eps_z ; stderr sig_z; var eps_g ; stderr sig_g; var eps_z, eps_g = q12;
which is

[quote]0.000074 0.000000
0.000000 0.000615[/quote]

First of all thank you very much for replying Mr. Pfeifer!

The reason why I want to estimate the covariance and not use Dynare’s built in command to estimate the correlations is that I want to get right
away the standard errors of the covariances (vs of the correlations) without having to use the delta-method on the standard errors of the estimated

Yes, the point you make about the variance of the structural shocks not being the same as the true one (e.g. q12+sig_z^2 not equal to sig_z^2)
is correct and the very point of my critique. Introducing the common shock and setting its variance to one, however, is the only suggestion I
found sofar in the Dynare forum to estimate covariances.

Many thanks again,

I see. So you are interested in inference about the covariances? If yes, there is an easy way around this if you are using Bayesian estimation. Covariances are a unique transformation from correlations and standard deviations. If you estimate the latter two, you can easily construct the posterior of the associated covariances from the posterior draws for correlations and standard deviations stored in Dynare. There is absolutely no reason for using the delta method in Dynare.

For ML, you would need to work with some hacking. You could define structural parameter that is used within a steady state file, to set the covariance in M_.Sigma_e. But note that when doing this, it is your responsibility to make sure the altered M_.Sigma_e is still positive definite and a valid covariance matrix (no implied correlations with absolute value larger than 1).

Many thanks for your kind help Mr. Pfeifer.