BETAPARMS Function |
%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
(The SOURCE needs to be done once)
source betaparms.src
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.
Copyright © 2025 Thomas A. Doan