public class BinomialDistribution extends Object implements ProbabilityDistribution
Constructor and Description |
---|
BinomialDistribution(int n,
double p)
Construct a Binomial distribution.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(double x)
Gets the cumulative probability F(x) = Pr(X ≤ x).
|
double |
density(double x)
This is the probability mass function.
|
double |
entropy()
Gets the entropy of this distribution.
|
double |
kurtosis()
Gets the excess kurtosis of this distribution.
|
double |
mean()
Gets the mean of this distribution.
|
double |
median()
Gets the median of this distribution.
|
double |
moment(double t)
The moment generating function is the expected value of etX.
|
double |
quantile(double u)
Gets the quantile, the inverse of the cumulative distribution function.
|
double |
skew()
Gets the skewness of this distribution.
|
double |
variance()
Gets the variance of this distribution.
|
public BinomialDistribution(int n, double p)
n
- the number of trials, a natural numberp
- the success probability in each trial, [0, 1]public double mean()
ProbabilityDistribution
mean
in interface ProbabilityDistribution
public double median()
median
in interface ProbabilityDistribution
public double variance()
ProbabilityDistribution
variance
in interface ProbabilityDistribution
public double skew()
ProbabilityDistribution
skew
in interface ProbabilityDistribution
public double kurtosis()
ProbabilityDistribution
kurtosis
in interface ProbabilityDistribution
public double cdf(double x)
cdf
in interface ProbabilityDistribution
x
- the number of success trials, an integer; rounded down to the closest integer if x is not an integerpublic double quantile(double u)
This may not always exist. Uses the Cornish-Fisher Expansion to include a skewness correction to a normal approximation. This gives an initial value which never seems to be off by more than 1 or 2. A search is then conducted of values close to this initial start point.F-1(u) = x, such that Pr(X ≤ x) = u
quantile
in interface ProbabilityDistribution
u
- a quantileqbinom(u)
public double density(double x)
density
in interface ProbabilityDistribution
x
- the number of success trials, an integer; rounded down to the closest integer if x is not an integerpmf(x)
public double entropy()
ProbabilityDistribution
entropy
in interface ProbabilityDistribution
public double moment(double t)
ProbabilityDistribution
E(etX)This may not always exist.
moment
in interface ProbabilityDistribution
t
- tCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.