Thanks to both of you for your clarifications. The wikipedia article would greatly benefit from your explanations :) Stéphane: I think it could be useful if you put your latex document on distributions in Dynare's documentation directory
I have removed all the distribution-related files which were not under the GPL. I also added support for the inverse gamma of type 2 in the preprocessor (and added some missing code in matlab files). Until now, the keyword "inv_gamma2_pdf" was supported in *.mod files, but it was giving a type 1 inverse gamma...
Two points:
1) It took me some time to figure out that in bayestopt_, p1 and p2 are mean and stddev for some distributions, while it is nu and s for inverse gammas (and p3 and p4 for uniform). Is there a good reason for not precomputing alpha and beta parameters for beta and gamma priors? At the present time, we recompute these alpha and beta parameters several times (actually every time we do a random draw in rndprior.m). By the way this would greatly simplify prior_draw.m, where we do this recomputation in a separate pass.
2) For inverse gamma type 1, there seems to be a bug in prior_bounds.m. It recomputes parameters nu and s in a strange way, while (if my understanding is correct), we have nu = bayestopt_.p2 and s = bayestopt_.p1. Note that, in the same file, the part for inverse gamma type 2 was added by myself.
Best
Sébastien
"Michel Juillard" michel.juillard@ens.fr a écrit :
The justification for inverse_gamma type 1, is that traditionaly, one takes inverse_gamma type 2 for the prior of variance. As we are settting priors for standard deviation, it seems more coherent to take inverse_gamma type 1 that is related to the previous one by a square root.
Best
Michel
Stéphane Adjemian wrote:
Salut Sébastien,
I think we wrote gamma_draw(), so you can use this one. But I am not sure that the code is the most efficient...
The parser should handle the inverse-gamma type 2.
For the inverse gammas you may look at something I wrote a couple of years ago:
http://www.cepremap.cnrs.fr/~adjemian/r/dynare/pdf/Distributions.pdf
It's an unfinished document (I have to find the tex source ;-) the definition of the beta is still missing. The informations given by wikipédia are incomplete. The definitions of the inv-gammas are standard (for bayesian statisticians ;-), we follow Zellner (1971) and also Bauwens, Lubrano and Richard (199?).
Best, Stéphane.
Le Monday 04 August 2008 17:03:55 Sébastien Villemot, vous avez écrit :
Hi all,
I have started the work of rewriting distribution-related functions, beginning by the easiest one (the normal).
Concerning the others, a few points:
- I discovered that prior_draw.m contains at the bottom a function
which draws samples from a gamma. This would solve our copyright problem with gamm_rnd.m, if you confirm to me that you wrote it.
- In some files, there is code for an inverse gamma of type 2
(represented by integer 6 in Dynare). This distribution is not handled by the preprocessor at this time. Should I add it ? Note that rndprior.m doesn't handle it, while prior_draw.m and draw_prior_density.m do.
- Just for your information, note that the wikipedia page on the
inverse gamma (http://en.wikipedia.org/wiki/Inverse-gamma_distribution) documents a distribution similar to your type-2-inv-gamma (up to a parameter rescaling). I could not find any page on your type-1-inv-gamma (represented by integer 4 in Dynare). This took me some time to understand, until I looked at the headers of lpdfig1.m and lpdfig2.m. Therefore it seems that the definition of what is inverse gamma is not really standardized.
- There are some factorization opportunities which I would like to
take advantage of:
- in prior_draw.m: currently does not take advantage of beta_rnd.m
(while rndprior.m does)
- in draw_prior_density.m: we could use the new PDF functions instead
of rewriting the PDF in an inline fashion
- factorize code for the two inverse gammas
Best
Sébastien
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev