Page 1 of 1

inverse gamma 1 distribution: bug?

PostPosted: Thu Nov 10, 2011 4:25 am
by woongp
Hi,

I was recently comparing estimation results from my codes and Dynare. There is a small difference in the log posterior (kernel). I am wondering whether it is because the two parameters (nu and s) of Inverse Gamma-1 computed by Dynare are not correct for some values of mean and standard deviation.

It seems that Dynare uses the following function to compute nu and s given mean and standard deviation.

\dynare-4.2.2\matlab\distributions\inverse_gamma_specification.m

For (mean 0.75, sd 0.1), the result of

[s,nu] = inverse_gamma_specification(0.75,0.1,1)

is

s = 11.2136
nu = 21.5870

But the correct answer is

s = 16.2409
nu = 30.3684

The numerical method to find a root in the function does not seem to work well for (mean 0.75, sd 0.1 or smaller).

Re: inverse gamma 1 distribution: bug?

PostPosted: Thu Nov 10, 2011 10:01 am
by StephaneAdjemian
Hi, Thanks for reporting this bug (I have added it to our bug tracker www.dynare.org/trac/225). We use a secant method to solve for nu. In this case, for an unknown reason, the algorithm diverge...

Best, Stéphane.