%BETAPARMS—Compute parameters for a beta distribution

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

%BETAPARMS—Compute parameters for a beta distribution

Unread post 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.
jonasdovern
Posts: 97
Joined: Sat Apr 11, 2009 10:30 am

Re: %BETAPARMS - Compute parameters for a beta distribution

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: %BETAPARMS - Compute parameters for a beta distribution

Unread post 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)
Post Reply