edu.uah.math.distributions
Class CouponDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.CouponDistribution
All Implemented Interfaces:
java.io.Serializable

public class CouponDistribution
extends Distribution
implements java.io.Serializable

This class models the distribution of the sample size needed to get a specified number of distinct sample values when sampling with replacement from a finite population of a specified size.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
CouponDistribution()
          This general constructor creates a new coupon distribution with population size 10 and and 10 distinct values.
CouponDistribution(int m, int k)
          This general constructor creates a new coupon distribution with specified population size and a specified number of distinct values.
 
Method Summary
 double getDensity(double x)
          This method computes the probability density function.
 int getDistinctValues()
          This method returns the number of distinct values in the sample.
 double getMean()
          This method computes the mean of the distribution.
 double getPGF(double t)
          This method computes the probability generating function of the distribution.
 int getPopulationSize()
          This method returns the population size.
 double getVariance()
          This method computes the variance of the distribution.
 void setDistinctValues(int k)
          This method sets the number of distinct values in the sample.
 void setParameters(int m, int k)
          This method sets the parameters: the population size and number of distinct values needed.
 void setPopulationSize(int m)
          This method sets the population size.
 double simulate()
          This method simulates a value from the distribution, by sampling with replacement from the population until the specified number of distinct sample values is obtained.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class edu.uah.math.distributions.Distribution
getCDF, getDomain, getFailureRate, getMaxDensity, getMedian, getMGF, getMoment, getMoment, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CouponDistribution

public CouponDistribution(int m,
                          int k)
This general constructor creates a new coupon distribution with specified population size and a specified number of distinct values.

Parameters:
m - the population size
k - the number of distinct sample values

CouponDistribution

public CouponDistribution()
This general constructor creates a new coupon distribution with population size 10 and and 10 distinct values.

Method Detail

setParameters

public void setParameters(int m,
                          int k)
This method sets the parameters: the population size and number of distinct values needed. The method also computes the default domain.

Parameters:
m - the population size
k - the number of distinct sample values

getDensity

public double getDensity(double x)
This method computes the probability density function.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the probability density at x

getMean

public double getMean()
This method computes the mean of the distribution.

Overrides:
getMean in class Distribution
Returns:
the mean

getVariance

public double getVariance()
This method computes the variance of the distribution.

Overrides:
getVariance in class Distribution
Returns:
the variance

getPopulationSize

public int getPopulationSize()
This method returns the population size.

Returns:
the population size

setPopulationSize

public void setPopulationSize(int m)
This method sets the population size.

Parameters:
m - the population size.

getDistinctValues

public int getDistinctValues()
This method returns the number of distinct values in the sample.

Returns:
the number of distinct values in the sample

setDistinctValues

public void setDistinctValues(int k)
This method sets the number of distinct values in the sample.

Parameters:
k - the number of distinct values in the sample

simulate

public double simulate()
This method simulates a value from the distribution, by sampling with replacement from the population until the specified number of distinct sample values is obtained.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

getPGF

public double getPGF(double t)
This method computes the probability generating function of the distribution.

Overrides:
getPGF in class Distribution
Parameters:
t - a real number
Returns:
the probability generating function at t

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class Distribution
Returns:
a string giving the name of the distribution and the values of the parameters