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.
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.
%BETAPARMS—Compute parameters for a beta distribution
-
jonasdovern
- Posts: 97
- Joined: Sat Apr 11, 2009 10:30 am
Re: %BETAPARMS - Compute parameters for a beta distribution
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
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
With support on [a,b] and shape parameters alpha,beta: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
compute cdfgbeta=%betainc((x-a)/(b-a),alpha,beta)