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

RE: st: RE: Hypergeometric Distribution

From   "Nick Cox" <>
To   <>
Subject   RE: st: RE: Hypergeometric Distribution
Date   Wed, 22 Aug 2007 16:06:20 +0100

Roger's posting includes what I presume is an allusion to 
an -egen- function _ghyper.ado that I wrote in 1999. 

I withdrew this program as redundant some years ago, 
given that you can use something like 

comb(K, k) * comb(N - K, n - k) / comb(N, n)

wherever you want. In context N, K, n, k may be 
variables, scalars or placeholders for numeric
constants, or any mixture thereof. 

This might need a wrapper to yield zeros where 
appropriate, or it might need care whenever 
individual terms get very large, but otherwise
does it raise any problems? 


Marcello Pagano
> I looked at --ssizebi-- but it seems to be focused on power 
> and sample 
> sizes.
Newson, Roger B wrote:

> > Thanks to Marcello for telling us all about this recently-published
> > algorithm, which looks very useful. A search on
> >
> > findit hypergeometric
> >
> > in Stata finds a single reference (to a SSC package), which was
> > distributed as long ago as 1999. This suggests that the new 
> algorithm
> > might be a good candidate for implementation in Mata by 
> Marcello, or by
> > anybody else with the time and inclination to do so.

Marcello Pagano

> Does anyone have or know of Stata code to calculate the Hypergeometric 
> Distribution accurately?
> See Journal of Discrete Algorithms ,  Volume 5 ,  Issue 2  (June 2007) 
> Pages: 341-347 for an article by Berkopec, HyperQuick algorithm for 
> discrete hypergeometric distribution 
> <
> 27443384&CFTOKEN=80678482>.

*   For searches and help try:

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