public class CouponDistribution extends Distribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getCDF, getDomain, getFailureRate, getMaxDensity, getMedian, getMGF, getMoment, getMoment, getQuantile, getSD, getType, setDomain, setDomain
public CouponDistribution(int m, int k)
m
- the population sizek
- the number of distinct sample valuespublic CouponDistribution()
public void setParameters(int m, int k)
m
- the population sizek
- the number of distinct sample valuespublic double getDensity(double x)
getDensity
in class Distribution
x
- a number in the domain of the distributionpublic double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public int getPopulationSize()
public void setPopulationSize(int m)
m
- the population size.public int getDistinctValues()
public void setDistinctValues(int k)
k
- the number of distinct values in the samplepublic double simulate()
simulate
in class Distribution
public double getPGF(double t)
getPGF
in class Distribution
t
- a real numberpublic java.lang.String toString()
toString
in class Distribution