 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Hypergeometric function

 From To Subject st: Hypergeometric function Date Thu, 21 Jul 2011 09:54:12 +0100

```------------------------------

Date: Wed, 20 Jul 2011 15:09:25 -0400
From: Austin Nichols <austinnichols@gmail.com>
Subject: Re: st: Hypergeometric function

Edward Norton <ecnorton@umich.edu>:
See
help f_hypergeometric
http://www.stata.com/help.cgi?f_hypergeometric
but it depends on the details, probably...
ssc desc gbgfit
will link you to a help file that says in part:
The Gini coefficient is not calculated as this requires
evaluation of the generalized hypergeometric 3F2, and this
function is not currently available in Stata.  Online evaluators are
available, at e.g. wolfram.com, where you can plug in specific
parameter values to calculate the generalized hypergeometric 3F2,
then use the formula given by McDonald (1984) to calculate the Gini.

On Wed, Jul 20, 2011 at 1:19 PM, Edward Norton <ecnorton@umich.edu>
wrote:
> Does Stata have a built-in hypergeometric function?  The
hypergeometric
> function is an infinite series related to differential equations.  (I
do not
> need the hypergeometric distribution, which is different and related
to
> sampling without replacement.)

---------------

Ed: why do you want a hypergeometric function? (And which one?)

In a private 'development' version of my -gb2fit- on SSC (Austin's
-gbgfit- is a sibling of this), I have some do file code that calculates
3F2  interatively using the series representation, stopping when a
user-defined convergence is reached. (GB2 is the generalised beta of the
second kind distribution.) The code is slow, and function evaluation
could now probably be done more easily in Mata (which didn't exist when
I wrote the code). But note that for the Gini coefficient, I found that
it was better not to use McDonald's 3F2-based formulae for the Gini
coefficient (Econometrica 1984): it was very much faster and just as
accurate to calculate the Gini directly by numerical integration. [I
used this method in my 2009 Review of Income and Wealth paper on the
GB2.]  I think James McDonald is now of a similar view -- from
"Modeling Income Distributions and Lorenz Curves", D Chotikapanich
(ed.), Springer, 2008.

Stephen
------------------
Professor Stephen P. Jenkins <s.jenkins@lse.ac.uk>
Department of Social Policy and STICERD
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, UK
Tel: +44(0)20 7955 6527
Survival Analysis Using Stata:
http://www.iser.essex.ac.uk/survival-analysis