Estimating Covariances (via ML) in Dynare

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Estimating Covariances (via ML) in Dynare

Postby francis » Wed May 13, 2015 5:49 pm

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 viewtopic.php?f=1&t=5547).

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,
etc.)

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,
Francis
Attachments
rbc_estim.mod
Estimates the Model
(2.77 KiB) Downloaded 65 times
rbc_estimmodel.mod
Simulates the model used in estimation (covariances imposed via introduction of common shock)
(2.2 KiB) Downloaded 67 times
rbc_simul.mod
Simulates the model (covariances imposed via Dynare command)
(2.12 KiB) Downloaded 102 times
francis
 
Posts: 23
Joined: Mon Jun 18, 2012 6:36 pm

Re: Estimating Covariances (via ML) in Dynare

Postby jpfeifer » Mon May 18, 2015 2:41 pm

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
Code: Select all
eps_z = sqrt(q12)*eps_zg + u_z;
eps_g = sqrt(q12)*eps_zg + u_g;

then
Code: Select all
cov(eps_z,eps_g)=q12,

but
Code: Select all
var(eps_z)=q12+sig_z^2
var(eps_g)=q12+sig_g^2

or
0.0001749 0.0001056
0.0001056 0.0007090

This is clearly not the same as

Code: Select all
var eps_z ; stderr sig_z;
var eps_g ; stderr sig_g;
var eps_z, eps_g = q12;

which is
0.000074 0.000000
0.000000 0.000615
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Estimating Covariances (via ML) in Dynare

Postby francis » Mon May 18, 2015 3:42 pm

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
correlations.

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,
Francis
francis
 
Posts: 23
Joined: Mon Jun 18, 2012 6:36 pm

Re: Estimating Covariances (via ML) in Dynare

Postby jpfeifer » Tue May 19, 2015 8:57 am

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).
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Estimating Covariances (via ML) in Dynare

Postby francis » Tue May 19, 2015 9:14 am

Many thanks for your kind help Mr. Pfeifer.

Best,
Francis
francis
 
Posts: 23
Joined: Mon Jun 18, 2012 6:36 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests