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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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? 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 n.j.cox@durham.ac.uk 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<tirthankar.chakravarty@gmail.com> 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<jriano@transparency.org> 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/

**Follow-Ups**:**RE: st: Beta transformation-- standardization technique***From:*"Juanita Riano" <jriano@transparency.org>

**References**:**RE: st: Beta transformation-- standardization technique***From:*Roy Wada <roywada@hotmail.com>

**RE: st: Beta transformation-- standardization technique***From:*"Juanita Riano" <jriano@transparency.org>

**Re: st: Beta transformation-- standardization technique***From:*Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>

**Re: st: Beta transformation-- standardization technique***From:*Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>

- Prev by Date:
**Re: st: multiple_imputation** - Next by Date:
**Re: st: multiple_imputation** - Previous by thread:
**RE: st: Beta transformation-- standardization technique** - Next by thread:
**RE: st: Beta transformation-- standardization technique** - Index(es):

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