public class BirthdayDistribution extends Distribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
BirthdayDistribution()
This default constructor creates a new birthday distribution with
population size 365 (the classical birthday problem) and sample size 20.
|
BirthdayDistribution(int n,
int k)
This general constructor creates a new birthday distribution with
a specified population size and sample size.
|
Modifier and Type | Method and Description |
---|---|
double |
getDensity(double x)
This method computes the probability density function.
|
double |
getMean()
This method computes the mean of the distribution in terms of the parameters.
|
int |
getPopulationSize()
This method returns the population size.
|
int |
getSampleSize()
This method returns the sample size.
|
double |
getVariance()
This method computes the variance of the distribution in terms of the parameters.
|
void |
setParameters(int n,
int k)
This method sets the parameters: the population size and the sample size.
|
void |
setPopulationSize(int n)
This method sets the population size.
|
void |
setSampleSize(int k)
This method sets the sample size.
|
double |
simulate()
This method simulates a value from the distribution.
|
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, getPGF, getQuantile, getSD, getType, setDomain, setDomain
public BirthdayDistribution(int n, int k)
n
- the population sizek
- the sample sizepublic BirthdayDistribution()
public void setParameters(int n, int k)
n
- the population sizek
- the sample sizepublic double getDensity(double x)
getDensity
in class Distribution
x
- a number in the domain of the distribuitonpublic double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public int getPopulationSize()
public void setPopulationSize(int n)
n
- the population sizepublic int getSampleSize()
public void setSampleSize(int k)
k
- the sample sizepublic double simulate()
simulate
in class Distribution
public java.lang.String toString()
toString
in class Distribution