Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Gamma functions in R and Stata's Gamma Functions


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Gamma functions in R and Stata's Gamma Functions
Date   Fri, 7 Mar 2008 18:55:36 -0000

Tiago gave only part of the specification for R's =pgamma()= 
(as nonce notation =function()= refers to R functions, 
to correspond to -function()- for Stata functions.) 

=pgamma()= allows you to specify rate or scale. They are reciprocals. 
So scale = 1/rate, rate = 1/scale. 

The nearest equivalent is Stata's -gammap()-. 

Stata uses the notation gammap(a, x). 

Here a is the shape parameter, x is the value. 

So where is the scale (or rate) parameter? Essentially you provide it
like this: 

gammap(a, x / scale) 

or like this: 

gammap(a, rate * x) 

For an example within a Stata program, look inside -pgamma.ado- from
SSC. 

Nick
[email protected] 

[email protected]

I am trying to implement a test that requires the incomplete gamma
function.

The R code is given by

example<- pgamma(Z, shape=X,rate=Y)

where Z is the critical value for a chi^2 distribution. I am not very
experienced with this distribution, and failed to find out the
corresponding counterpart in Stata. Hence, would it be possivle to you
to
provide me some tips to implement it in Stata?


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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