Extreme Optimization >
User's Guide >
Statistics Library >
Discrete Probability Distributions >
The Hypergeometric Distribution
Extreme Optimization User's Guide
User's Guide
Up: Discrete Probability Distributions Next: The Negative Binomial Distribution Previous: The Geometric Distribution Contents
The Hypergeometric Distribution
The hypergeometric distribution models a picking problem. Given
a number of tagged and untagged objects, the number
of tagged objects selected out of a fixed number of
selections follows a hypergeometric distribution. For example, if a
bag contains 8 white and 12 black balls, and 6 balls are taken out
of the bag at random, then the number of white balls chosen follows
a hypergeometric distribution.
The hypergeometric distribution is related to the binomial distribution. The main
difference is that the binomial distribution uses selection
with replacement, whereas the hypergeometric distribution
uses selection without replacement.
The hypergeometric distribution has three parameters:
the number of tagged objects, the number of untagged objects, and
the number of selections.
Examples of the hypergeometric distribution are:
- In quality control, the number of defective products
out of a sample of fixed size follows a hypergeometric
distribution.
- In biology, the size of an animal population can be estimated
by first tagging a known number of animals, and a short time later
recapturing a fixed number of animals. The number of tagged animals
in the recaptured samples follows a hypergeometric
distribution.
The Hypergeometric distribution is implemented by the
HypergeometricDistribution
class. It has one constructor with three parameters. The first
parameter is an integer that specifies the number of items in the
untagged population. The second parameter specifies the number of
items in the tagged population. The thirs parameter specifies the
number of samples drawn from the total population. The following
constructs a hypergeometric distribution for 20 tagged items, 10
untagged items, and 15 samples:
| C# | Copy Code |
HypergeometricDistribution hyper = new HypergeometricDistribution(20, 10, 15); |
| Visual Basic | Copy Code |
Dim hyper As HypergeometricDistribution = New HypergeometricDistribution(20, 10, 15) |
The HypergeometricDistribution class has three
specific properties.
TaggedPopulation returns the number of items in the
tagged population.
UntaggedPopulation returns the number of items in the
untagged population.
NumberOfSamples returns the number of samples drawn
from the entire population.
HypergeometricDistribution has one static
(Shared in Visual Basic) method,
GetRandomVariate, which generates a random variate
using a user-supplied uniform random number generator. The first
parameter is the random number generator. The remaining 3
parameters correspond to the parameters of the constructor.
| C# | Copy Code |
MersenneTwister random = new MersenneTwister();
double variate = HypergeometricDistribution.GetRandomVariate(random, 20, 10, 15); |
| Visual Basic | Copy Code |
Dim random As MersenneTwister = New MersenneTwister()
Dim variate As Double = HypergeometricDistribution.GetRandomVariate(random, 20, 10, 15) |
The above example uses the Mersenne
Twister to generate uniform random numbers.
For details of the properties and methods common to all discrete
probability distribution classes, see the topic on DiscreteDistribution
class.
Up: Discrete Probability Distributions Next: The Negative Binomial Distribution Previous: The Geometric Distribution Contents
Copyright 2004-2008,
Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M
Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual
Studio.NET, and the Visual Studio Logo are registered trademarks of Microsoft Corporation