Page 1 of 1

If calculations after MH take forever

PostPosted: Wed Apr 06, 2011 4:07 pm
by gbel
After MH iterations, the computations can get stuck on marginal_density.m because of a log(0).

If you have this problem, you can use this fix: using determinant properties, replace log(detSIGMA) with logdetSIGMA that is defined as
logdetSIGMA = 2*log(det(chol(SIGMA)));

See attached file, it's a modification of the 4.2 version of Dynare.

Hope this help!

Gilles

Re: If calculations after MH take forever

PostPosted: Wed Apr 06, 2011 7:21 pm
by gbel
A better idea is:
logdetSIGMA = 2*sum(log(diag(chol(SIGMA))));

That way, the estimated model can grow even more before the loss of precision becomes a problem.

I updated the marginal_density.m file.

Gilles

Re: If calculations after MH take forever

PostPosted: Thu Jul 21, 2011 11:27 am
by olayenidynare
This is so useful. The estimation that used to take about 60 mins takes less than 12 mins!!!!!

Many thanks for sharing this file. But what if there is no log(0) problem? Is the same modified file still useful?

Re: If calculations after MH take forever

PostPosted: Fri Jul 22, 2011 8:06 pm
by gbel
Yes.

The formula is exact (you can check for fun). In fact, it's more precise for all computations.

Gilles