*
* %GammaParms(mean,sd)
* returns a 2-vector (shape and scale in that order) with the two
* parameters for a Gamma distribution with the given mean and standard
* deviation. Note that the RATS functions %loggammadensity(x,a,b) and
* %rangamma(a) use a parameterization in terms of shape and scale, not
* degrees of freedom and mean. This returns the a and b appropriate for
* use with those functions.
*
* Example:
*
* source gammaparms.src (needs to be done once)
* compute gparms=%gammaparms(2.5,1.0)
* set test 1 1000 = gparms(2)*%rangamma(gparms(1))
* set logg 1 1000 = %loggammadensity(test,gparms(1),gparms(2))
*
* will create a series named TEST with gammas with (population) mean 2.5
* and standard deviation 1.0 and the log density (in LOGG) at each drawn
* value.
*
* Revision Schedule:
* 07/2009 Written by Tom Doan, Estima.
* 10/2011 Revised to return shape followed by scale (went the other way).
*
function %GammaParms mean sd
type vect[real] %GammaParms
type real mean
type real sd
*
compute %GammaParms=||mean^2/sd^2,sd^2/mean||
end