Differences between revisions 1 and 2
Revision 1 as of 2008-05-07 15:01:43
Size: 1129
Comment:
Revision 2 as of 2008-05-07 20:49:36
Size: 1318
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
= Matrix of variance-covariance of posterior distribution of estimated parameters = = Posterior covariance matrix of the estimated parameters =
 
After the metropolis (that is after the '''estimation''' command in the mod file) you just have to write:
Line 5: Line 7:
After your metropolis (that is after the estimation command in the mod file)
you just have to write :
{{{
compute_mh_covariance_matrix;
}}}
Line 8: Line 11:
compute_mh_covariance_matrix;

This matlab routine will estimate the mode, the mean and the covariance matrix
of the posterior distribution from the mcmc draws. The estimated mode
(xparam1), the logged posterior density at the mode (fval) and the inverse of
the estimated covariance matrix (hh) are saved in a matlab mat file called :
This matlab routine will estimate the mode, the mean and the covariance matrix of the posterior distribution from the MCMC draws. The estimated mode (xparam1), the logged posterior density at the mode (fval) and the inverse of the estimated covariance matrix (hh) are saved in a matlab *.mat file called :
Line 17: Line 15:
You can load this file and get the estimated covariance matrix by inversing
hh.
You can load this file and get the estimated covariance matrix by inversing hh. The ''inverse of the posterior covariance matrix is saved and not the covariance matrix itself'' because it may help to use this _mh_mode file to restart a new metropolis (hopefully, with a better estimate of the posterior covariance matrix of the parameters).
Line 20: Line 17:
I save the inverse of the estimated covariance matrix and not the covariance
matrix itself because I often use this _mh_mode file to restart a new
metropolis (with, hopefully, a better estimate of the covariance matrix).
If the following syntax is used:
Line 24: Line 19:
A recursive approach is used to estimate the covariance matrix so we don't
have to load all the draws of the mcmc at once.
{{{
[ M, S ] = compute_mh_covariance_matrix;
}}}

then M and S are the posterior mean and covariance matrix.


As described in [], a recursive approach is used to estimate the covariance matrix so we don't have to load all the draws of the MCMC at once.

Posterior covariance matrix of the estimated parameters

After the metropolis (that is after the estimation command in the mod file) you just have to write:

compute_mh_covariance_matrix;

This matlab routine will estimate the mode, the mean and the covariance matrix of the posterior distribution from the MCMC draws. The estimated mode (xparam1), the logged posterior density at the mode (fval) and the inverse of the estimated covariance matrix (hh) are saved in a matlab *.mat file called :

<THE NAME OF YOUR MOD FILE>_mh_mode.mat

You can load this file and get the estimated covariance matrix by inversing hh. The inverse of the posterior covariance matrix is saved and not the covariance matrix itself because it may help to use this _mh_mode file to restart a new metropolis (hopefully, with a better estimate of the posterior covariance matrix of the parameters).

If the following syntax is used:

[ M, S ] = compute_mh_covariance_matrix;

then M and S are the posterior mean and covariance matrix.

As described in [], a recursive approach is used to estimate the covariance matrix so we don't have to load all the draws of the MCMC at once.

DynareWiki: PosteriorVariance (last edited 2009-03-25 17:11:59 by localhost)