For the draws from the gamma, beta and others we can use the GSL library. I can do it for the end of august. I already use this library to evaluate the prior densities, to evaluate the cdf and inverse cdf, to compute the prior bounds and to compute the parameters of the prior densities (for instance parameters nu and s of the inverse gamma from the mean and the std.)
Best, Stéphane.
Le Saturday 02 August 2008 18:52:23 Sébastien Villemot, vous avez écrit :
Le samedi 02 août 2008 à 16:42 +0200, Michel Juillard a écrit :
- The remaining files are used to compute pdf, cdf and quantiles of
several distributions. All these functions exist natively under Octave: http://www.gnu.org/software/octave/doc/interpreter/Distributions.html Some of the Octave functions are written in script language, so we can directly incorporate them into Dynare; others use DLLs, so in those cases we must write an alternative in a M-file. Stéphane also said to me that he intend to write a DLL linked to GSL for all thoses functions.
As much as possible, we should keep M f iles equivalent to DLL that we may use. How many of these functions are DLL only in Octave?
A first remark: all those distribution-related functions are present in Matlab's statistical toolbox (see http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html), and have their free clones in Octave.
Actually we can directly adapt the following from Octave: PDF, CDF and quantiles for gamma, beta, normal, chi square This covers the 10 files which are copyright Anders Holtsberg
I am ok to do that job; I suggest to name the new files after Matlab's statistical toolbox naming (which is also Octave naming), then to put the new files in a subdirectory called "distributions", and to only add this dir in the path only when the user is using Matlab without the Statistics Toolbox, so that we use native routines when the toolbox is present or when under Octave.
The two remaining files are random draws for the gamma and the beta (the latter can be easily derived from the former). Octave has a DLL primitive for random draws from the gamma, which is not available in Matlab without the statistical toolbox.
In other words, we must rewrite the current gamm_rnd.m. This file uses an algorithm which I don't know. Another simple solution is to use the gamma quantile function applied on random draws of a uniform in [0,1], but I don't know if this theoretical method is numerically relevant. Any suggestion?
Best
Sébastien
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev