Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • negative hyper-geometric distribution

    Unlike some other distributions (negative binomial), Stata does not seem to have a function for negative hyper-geometric distribution. This is the the built-in function for hyper-geometric distribution: p = hypergeometric(N, K, n, k).
    Does anyone know if there is a user written program or any other way of getting the cumulative probability values for a negative hyper-geometric distribution? Thanks for any help or guidance you can provide.

  • #2
    At

    https://encyclopediaofmath.org/wiki/...c_distribution

    there is an equation relating the negative hypergeometric distribution function to that for the hypergeometric distribution function. Perhaps that will help you.

    Comment


    • #3
      Thank you William. I have seen that but I lack background to implement it on Stata.

      Comment


      • #4
        Stata tells us
        Code:
           hypergeometric(N,K,n,k)
               Description:  the cumulative probability of the hypergeometric distribution
                
                             N is the population size, K is the number of elements in the population
                             that have the attribute of interest, and n is the sample size.  
                             Returned is the probability of observing k or fewer elements
                             from a sample of size n that have the attribute of interest.
        In the terms of the linked article, the cumulative hypergeometric distribution G(m) with parameters N, M, and n - the probability of obtaining m or fewer "marked" elements when sampling n elements from a population of N elements of which M are marked - would be G(m) which in Stata is given by hypergeometric(N,M,n,m).

        The linked article tells us the cumulative negative hypergeometric distribution F(n) with parameters N, M, and m - the probability that it will require a sample of n or fewer elements to yield m "marked" elements when sampling from of population of N elements of which M are marked - would be F(n) = 1 - G(m-1). From the above, G(m-1) = hypergeometric(N,M,n,m-1). Substituting this in tells us that in Stata F(n) would be given by 1 - hypergeometric(N,M,n,m-1).
        Last edited by William Lisowski; 10 Aug 2020, 20:38.

        Comment


        • #5
          Thank you William.

          Comment

          Working...
          X