[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Beta transformation-- standardization technique

From   "Nick Cox" <>
To   <>
Subject   RE: st: Beta transformation-- standardization technique
Date   Sun, 12 Jul 2009 19:03:54 +0100

Tirthankar is pointing in the right direction here. 

Note also the existing FAQ: 
How do I calculate values of the beta function?

which -search beta- would have revealed. 

However, caution is advised when using -lngamma()-. In essence the reason for -lngamma()- is that the gamma function grows explosively as x becomes large and positive. So, we work with its logarithm instead. Thus, use -lngamma()- as much as possible and use -exp()- as late as possible. 

Thus the FAQ advises calculating the beta function this way

exp(lngamma(a) + lngamma(b) - lngamma(a + b))  

and the same advice holds for related functions and integrals. Thus, Tirthankar's example 


would be better as 

exp(lngamma(2) + lngamma(1) - lngamma(3)) 

which needs fewer function evaluations as well as being better practice to avoid overflows. 


Tirthankar Chakravarty

Here's an example:

*** begin
sysuse auto
g x = log(price)/10
g new = (exp(lngamma(2))*exp(lngamma(1))/exp(lngamma(3)))*ibeta(2,1,x)
// alpha = 2, beta = 1
su new
*** end

On Fri, Jul 10, 2009 at 4:17 PM, Tirthankar
Chakravarty<> wrote:

> help ibeta
> What you want can be written as:
> (gamma(a)*gamma(b)/gamma(a+b))*ibeta(a,b,x)

> On Fri, Jul 10, 2009 at 3:58 PM, Juanita Riano<> wrote:

>> Thanks for the suggestion Roy, maybe I was not clear enough with my
>> posting. What I need is to transform my data solving the following
>> integral:
>> Integral of [X^(alpha-1)*(1-X)^(Beta-1)] where alpha and beta are known
>> parameters
>>> I am wondering if anyone knows of any routine in Stata that I could
>> use
>>> for standardizing data using a beta transformation technique for which
>> I
>>> have already the parameters.

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index