## estimation of Error Variance-Covariance matrix

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.

### estimation of Error Variance-Covariance matrix

Hi,

I have a simple two-country model that reads four data series, Consumption and Dividend of Two Countries.
I have four shocks and want to estimate the parameters in the shock Variance-Covariance matrix (correlation, and variance). It seems the best way to learn is to learn from the simplest example possible.

Is there a minimal example that would allow me to achieve this, through any one of, or preferrably I want to see both, by utilizing:
1.Particle Filter, applied on RBC.mod
2.SMM, applied on RBC.mod
Per the standard Dynare example mod file at http://www.dynare.org/documentation-and-support/examples/rbc.zip, I apolgoize if RBC.mod is inappropiate and there are better minimal examples out there that deals with estimation as well.

Thank you.
onthetopo

Posts: 10
Joined: Tue May 16, 2017 11:22 pm

### Re: estimation of Error Variance-Covariance matrix

1. What do you mean? All you need to do is specify the variances and covariances as estimated parameters. E.g. as in https://github.com/DynareTeam/dynare/blob/master/tests/TeX/fs2000_corr_ME.mod:
Code: Select all
`varexo e_a e_m;estimated_params;stderr e_a, inv_gamma_pdf, 0.035449, inf;stderr e_m, inv_gamma_pdf, 0.008862, inf;corr e_m, e_a, normal_pdf, 0, 0.2;end;`

2. SMM is cirrently not supported by Dynare. You can do that manually (e.g. shown in the replication codes to Born/Pfeifer (2014)). But doing this is quite involved and SMM is usually not well-suited for estimating covariance matrices due to weak identification. Full-information methods typically work better.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: estimation of Error Variance-Covariance matrix

Thank you sir.
1.By full information model: you mean MLE?
2.The FS2000 example seems to be Bayesian based, as the cited paper indicates, based on loss functions.

are deprecated in current versions of dynare, though they existed in older versions of dynare
onthetopo

Posts: 10
Joined: Tue May 16, 2017 11:22 pm

### Re: estimation of Error Variance-Covariance matrix

1. Anything that is likelihood based, i.e. either MLE or Bayesian estimation
2. Yes, fs2000.mod is Bayesian estimation, but there are also version of the file using MLE. The loss function only comes into play for evaluating the model fit, not for estimation itself.
3. I don't understand your last sentence.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: estimation of Error Variance-Covariance matrix

Sorry, in the last sentence, I was going to say that, in the example mod you gave me:

contemporaneous_correlation
conditional_variance_decomposition=[1 2 4]
smoothed_state_uncertainty

seem to be all deprecated in current version of dynare
onthetopo

Posts: 10
Joined: Tue May 16, 2017 11:22 pm

### Re: estimation of Error Variance-Covariance matrix

No, these are new options that will be available in Dynare 4.5 (hopefully next month). At the current stage, you would need the unstable version: http://www.dynare.org/download/dynare-unstable/
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: estimation of Error Variance-Covariance matrix

Thank you so much for your help. One question that looks strange is that, in https://github.com/DynareTeam/dynare/bl ... orr_ME.mod:
The line
corr e_m, e_a, normal_pdf, 0, 0.2;
only appears in the estimated_params block.

However, in the shocks block we have instead:
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
corr gy_obs,gp_obs = 0.5;
end;

Two questions,
1.In the shocks block, we have var e_a; stderr 0.014; does 0.014 have to be the mode of the prior?
2. Why is that an initialized value corr e_m, e_a, 0 is not present in the shocks block? but corr gy_obs,gp_obs = 0.5; is present in the shocks block.
onthetopo

Posts: 10
Joined: Tue May 16, 2017 11:22 pm

### Re: estimation of Error Variance-Covariance matrix

Those are two different things. The
Code: Select all
`shocks`

block calibrates the model. These values are kept at the fixed value unless you estimate them in the
Code: Select all
`estimated_params block`

The test mod-file is unusual in that it calibrates some variances and estimates some. That is because we want to test both features.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: estimation of Error Variance-Covariance matrix

Thanks.

1.When both are declared in the shocks block and in the estimated_params block, am I right to think that what dynare uses to calculate the stochastic steady states and moments in stoch_simul(), is 0.014 as in the shocks block, but in estimation() when initializing a prior, 0.035449 is used, as in the estimated_params block?

shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
corr gy_obs,gp_obs = 0.5;
end;

estimated_params;
alp, 0.356;
gam, 0.0085;
del, 0.01;
stderr e_a, 0.035449;
stderr e_m, 0.008862;
corr e_m, e_a, 0;
stderr gp_obs, 1;
stderr gy_obs, 1;
corr gp_obs, gy_obs,0;
end;

2. Suppose I want to write up a paper with estimation, how do I describe the estimation procedure in the paper? Any existing paper that uses dynare to estimate parameters in general, and stderr of errors in particular, which I can follow in terms of methodology description? I am using mode_compute=6. Schorfheide 2000 provides a technical description in general.
onthetopo

Posts: 10
Joined: Tue May 16, 2017 11:22 pm

### Re: estimation of Error Variance-Covariance matrix

1. Yes, that is correct. The shocks-block preceeding the stoch_simul command provides the values for the IRFs etc. computed by stoch_simul while the value in the estimated_params-block is the starting value for estimation.
2. The standard reference for what is going on is An/Schorfheide (2006). Papers that use Dynare for estimation are Smets/Wouters (2007) or e.g. my own work Born/Peter/Pfeifer (2013).
------------
Johannes Pfeifer
University of Cologne