public class Binomial extends DiscreteDistribution
Constructor and Description |
---|
Binomial()
Creates a new Binomial distribution for 1 trial with a 0.5 probability of
success
|
Binomial(int trials,
double p)
Creates a new Binomial distribution
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(int x)
Computes the value of the Cumulative Density Function (CDF) at the given point.
|
Binomial |
clone() |
double |
getP() |
int |
getTrials() |
double |
logPmf(int x)
Computes the log of the Probability Mass Function.
|
double |
max()
The maximum value for which the
#pdf(double) is meant to return
a value. |
double |
mean()
Computes the mean value of the distribution
|
double |
median()
Computes the median value of the distribution
|
double |
min()
The minimum value for which the
#pdf(double) is meant to return
a value. |
double |
mode()
Computes the mode of the distribution.
|
double |
pmf(int x) |
void |
setP(double p)
Sets the probability of a trial being a success
|
void |
setTrials(int trials)
The number of trials for the distribution
|
double |
skewness()
Computes the skewness of the distribution.
|
double |
variance()
Computes the variance of the distribution.
|
cdf, invCdf, invCdf
getFunctionCDF, sample, sampleVec, standardDeviation
public Binomial()
public Binomial(int trials, double p)
trials
- the number of independent trialsp
- the probability of successpublic void setTrials(int trials)
trials
- the number of trials to performpublic int getTrials()
public void setP(double p)
p
- the probability of success for each trialpublic double getP()
public double logPmf(int x)
DiscreteDistribution
Double.NEGATIVE_INFINITY
would be the true
value. Instead, this method will always return the negative of
Double.MAX_VALUE
. This is to avoid propagating bad values through
computation.logPmf
in class DiscreteDistribution
x
- the value to get the log(PMF) ofpublic double pmf(int x)
pmf
in class DiscreteDistribution
public double cdf(int x)
DiscreteDistribution
cdf
in class DiscreteDistribution
x
- the value to get the CDF ofpublic double mean()
Distribution
mean
in class Distribution
public double median()
Distribution
median
in class Distribution
public double mode()
Distribution
NaN
may be returned if the mode is not defined for the current values of the
distribution.mode
in class Distribution
public double variance()
Distribution
NaN
may be
returned if the variance is not defined for the current values of the distribution.
Infinity
is a possible value to be returned
by some distributions.variance
in class Distribution
public double skewness()
Distribution
NaN
may be
returned if the skewness is not defined for the current values of the distribution.skewness
in class Distribution
public double min()
Distribution
#pdf(double)
is meant to return
a value. Note that Double.NEGATIVE_INFINITY
is a valid return
value.min
in class Distribution
#pdf(double)
is meant to
return a value.public double max()
Distribution
#pdf(double)
is meant to return
a value. Note that Double.POSITIVE_INFINITY
is a valid return
value.max
in class Distribution
#pdf(double)
is meant to
return a value.public Binomial clone()
clone
in class DiscreteDistribution
Copyright © 2017. All rights reserved.