public class BinomialRandomNDistribution extends Distribution
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
BinomialRandomNDistribution()
This default constructor creates a new randomized binomial distribution with
probability of success 0.5 and the uniform distribution on {1, 2, 3, 4, 5, 6}
or the number of trials.
|
BinomialRandomNDistribution(Distribution d,
double p)
This general constructor creates a new randomized binomial distribution with a
specified probability of success and a specified distribution for the number of
trials.
|
BinomialRandomNDistribution(double p)
This special constructor creates a new randomized binomial distribution with a
specified probability of success and the uniform distribution on {1, 2, 3, 4, 5, 6}
for the number of trials.
|
Modifier and Type | Method and Description |
---|---|
double |
getDensity(double x)
This method computes the probability density function in terms of the
probability density of the number of trials and the probability of success.
|
Distribution |
getDistribution()
This method gets the distribution for the number of trials.
|
double |
getMean()
This method computes the mean in terms of the mean of the number of trials and
the probability of success.
|
double |
getMGF(double t)
This method computes the moment generating funciton in terms of the probability
generating function,
|
double |
getPGF(double t)
This method computes the probability generating function in terms of the probability
generating function of the number of trials and the probability of success.
|
double |
getProbability()
This method returns the probability of success.
|
double |
getVariance()
This method computes the variance in terms of the mean and variance of the
number of trials and the probability of success.
|
void |
setDistribution(Distribution d)
This method sets the distribution for the number of trials.
|
void |
setParameters(Distribution d,
double p)
This method sets the parameters: the distribution for the number of trials and the
probability of success.
|
void |
setProbability(double p)
This method sets the probability of success.
|
double |
simulate()
This method simulates a value from the distribution, by simulating a random number
of Bernoulli trials and then computing the number of successes.
|
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, getMoment, getMoment, getQuantile, getSD, getType, setDomain, setDomain
public BinomialRandomNDistribution(Distribution d, double p)
d
- the distribution of the number of trialsp
- the probabiltiy of successpublic BinomialRandomNDistribution(double p)
p
- the probability of successpublic BinomialRandomNDistribution()
public void setParameters(Distribution d, double p)
d
- the distribution of the number of trialsp
- the probability of successpublic void setDistribution(Distribution d)
d
- the distribution of the number of trials.public Distribution getDistribution()
public void setProbability(double p)
p
- the probability of successpublic double getProbability()
public 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 double getPGF(double t)
getPGF
in class Distribution
t
- a real numberpublic double getMGF(double t)
getMGF
in class Distribution
t
- a real numberpublic double simulate()
simulate
in class Distribution
public java.lang.String toString()
toString
in class Distribution