*
* %BetaParms(mean,sd)
* returns a 2-vector with the two parameters for a Beta distribution with
* the given mean and standard deviation. The mean must in the range (0,1)
* and the standard deviation in (0,sqrt(mean*(1-mean)))
*
* Example:
*  source betaparms.src (needs to be done once)
*  compute bparms=%BetaParms(.50,.20)
*  set test 1 1000 = %ranbeta(bparms(1),bparms(2))
*  set logg 1 1000 = %logbetadensity(test,bparms(1),bparms(2))
*
* will create a series named TEST with beta draws with (population) mean
* .5 and standard deviation .2 and the log density (in LOGG) at each
* drawn value.
*
* Revision Schedule:
*  07/2009 Written by Tom Doan, Estima.
*
function %BetaParms mean sd
type vect[real] %BetaParms
type real mean
type real sd
*
local real temp
compute temp=mean*(1-mean)/sd^2-1
compute %BetaParms=||mean*temp,(1-mean)*temp||
end

