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()
ProbabilityDistributionmean in interface ProbabilityDistributionpublic double median()
median in interface ProbabilityDistributionpublic double variance()
ProbabilityDistributionvariance in interface ProbabilityDistributionpublic double skew()
ProbabilityDistributionskew in interface ProbabilityDistributionpublic double kurtosis()
ProbabilityDistributionkurtosis in interface ProbabilityDistributionpublic double cdf(double x)
cdf in interface ProbabilityDistributionx - 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 ProbabilityDistributionu - a quantileqbinom(u)public double density(double x)
density in interface ProbabilityDistributionx - the number of success trials, an integer; rounded down to the closest integer if x is not an integerpmf(x)public double entropy()
ProbabilityDistributionentropy in interface ProbabilityDistributionpublic double moment(double t)
ProbabilityDistributionE(etX)This may not always exist.
moment in interface ProbabilityDistributiont - tCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.