Statalist


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

RE: st: Beta transformation-- standardization technique


From   "Juanita Riano" <[email protected]>
To   <[email protected]>
Subject   RE: st: Beta transformation-- standardization technique
Date   Mon, 13 Jul 2009 18:01:32 +0200

Dear Nick and Tirthankar, 

Many thanks for replying to my question. 

Juanita 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 12 July 2009 20:04
To: [email protected]
Subject: RE: st: Beta transformation-- standardization technique

Tirthankar is pointing in the right direction here. 

Note also the existing FAQ: 
How do I calculate values of the beta function?
http://www.stata.com/support/faqs/stat/beta.html

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 

(exp(lngamma(2))*exp(lngamma(1))/exp(lngamma(3)))

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. 

Nick 
[email protected] 

Tirthankar Chakravarty

Here's an example:

*** begin
clear*
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<[email protected]> 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<[email protected]> 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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Transparency International is the global civil society organisation leading the fight against 
corruption.
www.transparency.org

This email is confidential and intended for the addressee only. If you are not the intended 
recipient, any use, disclosure, distribution, printing or copying of this email is unauthorised.
If you have received this email in error, please immediately notify the sender by replying to the 
email, then delete all copies from your computer. This email and its attachments have been swept 
for computer viruses but Transparency International accepts no responsibility whatsoever for damage
caused by viruses in connection with this email. Transparency International may monitor all emails
and attachments as it is presumed that they are sent or received in connection with the activities
of TI and to ensure the integrity of its computer systems. Statements and opinions contained in 
this email are those of the sender, not necessarily of Transparency International.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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