Page 1 of 1

%BETAPARMS—Compute parameters for a beta distribution

Posted: Mon May 07, 2012 1:58 pm
by TomDoan
This function returns a 2-vector with the parameters for a beta distribution which has a requested mean and standard deviation. The beta is often used for the prior for a model parameter which has support on (0,1) and can be adapted easily to handle support on more general finite intervals.
betaparms.src
Function file
(881 Bytes) Downloaded 1040 times
Because it's a function (not a procedure), you need to do a SOURCE instruction on the file before you can use it in a RATS program.

target VECTOR=%BetaParms(mean,sd)

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.

Re: %BETAPARMS - Compute parameters for a beta distribution

Posted: Sun Jul 07, 2013 9:52 am
by jonasdovern
Dear RATS users,

is there any simple way to obtain the CDF of a "generalized" beta distribution with support over a to b (rather than 0 to 1) using the basic functions available in RATS?

(I'd like to estimate the parameters of such a distribution based on empirically observed CDF-values from surveys (I have probabilities assigned to different "bins"/forecast intervals) using NLLS.)

Best regards,
Jonas

Re: %BETAPARMS - Compute parameters for a beta distribution

Posted: Sun Jul 07, 2013 11:50 am
by TomDoan
jonasdovern wrote:Dear RATS users,

is there any simple way to obtain the CDF of a "generalized" beta distribution with support over a to b (rather than 0 to 1) using the basic functions available in RATS?

(I'd like to estimate the parameters of such a distribution based on empirically observed CDF-values from surveys (I have probabilities assigned to different "bins"/forecast intervals) using NLLS.)

Best regards,
Jonas
With support on [a,b] and shape parameters alpha,beta:

compute cdfgbeta=%betainc((x-a)/(b-a),alpha,beta)