public class BinomialDistribution extends Distribution implements java.io.Serializable
CONTINUOUS, DISCRETE, MIXED
Constructor and Description |
---|
BinomialDistribution()
This default constructor creates the binomial distribution with 10 trials
and probability of success 0.5.
|
BinomialDistribution(int n,
double p)
This general constructor creates the binomial distribution with a specified
number of trials and probabiltiy of success.
|
Modifier and Type | Method and Description |
---|---|
double |
getCDF(double x)
This method computes the cumulative distribution function in terms of the beta
cumulative distribution function.
|
double |
getDensity(double x)
This method computes the probability density function in terms of the number
of trials and the probability of success.
|
double |
getFactorialMoment(int k)
This method returns the factorial moment of a specified order.
|
double |
getMaxDensity()
This method returns the maximum value of the density function.
|
double |
getMean()
This method computes the mean in terms of the number of trials and the probability
of success.
|
double |
getMGF(double t)
This method computes the moment generating function in terms of the
probability generating function.
|
double |
getPGF(double t)
This method computes the probability generating function in terms of the
number of trials and the probability of success.
|
double |
getProbability()
This method returns the probability of success.
|
int |
getTrials()
This method returns the number of trials.
|
double |
getVariance()
This method computes the variance in terms of the probability of success and
the number of trials.
|
void |
setParameters(int n,
double p)
This method sets the number of trials and the probability of success, and
computes the default domain.
|
void |
setProbability(double p)
This method sets the probability of success.
|
void |
setTrials(int n)
This method sets the number of trails.
|
double |
simulate()
This method simulates the 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.
|
getDomain, getFailureRate, getMedian, getMoment, getMoment, getQuantile, getSD, getType, setDomain, setDomain
public BinomialDistribution(int n, double p)
n
- the number of trialsp
- the probability of successpublic BinomialDistribution()
public void setParameters(int n, double p)
public void setTrials(int n)
n
- the number of trialspublic int getTrials()
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 getMaxDensity()
getMaxDensity
in class Distribution
public double getMean()
getMean
in class Distribution
public double getVariance()
getVariance
in class Distribution
public double getCDF(double x)
getCDF
in class Distribution
x
- a number in the domain of the distributionpublic double simulate()
simulate
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 getFactorialMoment(int k)
k
- the orderpublic java.lang.String toString()
toString
in class Distribution