gov.sandia.cognition.statistics.distribution
Class BinomialDistribution.PMF

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.AbstractDistribution<NumberType>
          extended by gov.sandia.cognition.statistics.AbstractClosedFormUnivariateDistribution<Number>
              extended by gov.sandia.cognition.statistics.distribution.BinomialDistribution
                  extended by gov.sandia.cognition.statistics.distribution.BinomialDistribution.PMF
All Implemented Interfaces:
Evaluator<Number,Double>, Vectorizable, ClosedFormComputableDistribution<Number>, ClosedFormDiscreteUnivariateDistribution<Number>, ClosedFormDistribution<Number>, ClosedFormUnivariateDistribution<Number>, ComputableDistribution<Number>, DiscreteDistribution<Number>, Distribution<Number>, DistributionWithMean<Number>, EstimableDistribution<Number,BinomialDistribution>, ProbabilityFunction<Number>, ProbabilityMassFunction<Number>, UnivariateDistribution<Number>, CloneableSerializable, Serializable, Cloneable
Enclosing class:
BinomialDistribution

public static class BinomialDistribution.PMF
extends BinomialDistribution
implements ProbabilityMassFunction<Number>

The Probability Mass Function of a binomial distribution.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gov.sandia.cognition.statistics.distribution.BinomialDistribution
BinomialDistribution.CDF, BinomialDistribution.MaximumLikelihoodEstimator, BinomialDistribution.PMF
 
Field Summary
 
Fields inherited from class gov.sandia.cognition.statistics.distribution.BinomialDistribution
DEFAULT_N, DEFAULT_P
 
Constructor Summary
BinomialDistribution.PMF()
          Default constructor.
BinomialDistribution.PMF(BinomialDistribution other)
          Copy constructor
BinomialDistribution.PMF(int N, double p)
          Creates a new instance of PMF
 
Method Summary
static double evaluate(int N, int k, double p)
          Returns the binomial CDF for the parameters N, k, p, which is the probability of exactly k successes in N experiments with expected per-trial success probability (Bernoulli) p
 Double evaluate(Number input)
          Returns the binomial PMF for the parameters N, k, p, which is the probability of exactly k successes in N experiments with expected per-trial success probability (Bernoulli) p
 double getEntropy()
          Gets the entropy of the values in the histogram.
 BinomialDistribution.PMF getProbabilityFunction()
          Gets the distribution function associated with this Distribution, either the PDF or PMF.
static double logEvaluate(int N, int k, double p)
          Computes the natural logarithm of the PMF.
 double logEvaluate(Number input)
          Evaluate the natural logarithm of the distribution function.
 
Methods inherited from class gov.sandia.cognition.statistics.distribution.BinomialDistribution
clone, convertFromVector, convertToVector, getCDF, getDomain, getDomainSize, getEstimator, getMaxSupport, getMean, getMinSupport, getN, getP, getVariance, sample, setN, setP
 
Methods inherited from class gov.sandia.cognition.statistics.AbstractDistribution
sample
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.statistics.DiscreteDistribution
getDomain, getDomainSize
 
Methods inherited from interface gov.sandia.cognition.statistics.Distribution
sample, sample
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Constructor Detail

BinomialDistribution.PMF

public BinomialDistribution.PMF()
Default constructor.


BinomialDistribution.PMF

public BinomialDistribution.PMF(int N,
                                double p)
Creates a new instance of PMF

Parameters:
N - Total number of experiments, must be greater than zero
p - Probability of a positive outcome (Bernoulli probability), [0,1]

BinomialDistribution.PMF

public BinomialDistribution.PMF(BinomialDistribution other)
Copy constructor

Parameters:
other - BinomialDistribution to copy
Method Detail

evaluate

public Double evaluate(Number input)
Returns the binomial PMF for the parameters N, k, p, which is the probability of exactly k successes in N experiments with expected per-trial success probability (Bernoulli) p

Specified by:
evaluate in interface Evaluator<Number,Double>
Parameters:
input - Number of successes
Returns:
Probability of exactly input successes in N experiments with expected per-trial success probability (Bernoulli) p

evaluate

public static double evaluate(int N,
                              int k,
                              double p)
Returns the binomial CDF for the parameters N, k, p, which is the probability of exactly k successes in N experiments with expected per-trial success probability (Bernoulli) p

Parameters:
N - Total number of experiments
k - Total number of successes
p - Expected probability of success, Bernoulli parameter
Returns:
Probability of exactly k successes in N experiments with expected per-trial success probability (Bernoulli) p

logEvaluate

public double logEvaluate(Number input)
Description copied from interface: ProbabilityFunction
Evaluate the natural logarithm of the distribution function. This is sometimes more efficient than evaluating the distribution function itself, and when evaluating the product of many independent or exchangeable samples.

Specified by:
logEvaluate in interface ProbabilityFunction<Number>
Returns:
Natural logarithm of the distribution function.

logEvaluate

public static double logEvaluate(int N,
                                 int k,
                                 double p)
Computes the natural logarithm of the PMF.

Parameters:
N - Total number of experiments
k - Total number of successes
p - Expected probability of success, Bernoulli parameter
Returns:
Computes the natural logarithm of the PMF.

getEntropy

public double getEntropy()
Description copied from interface: ProbabilityMassFunction
Gets the entropy of the values in the histogram.

Specified by:
getEntropy in interface ProbabilityMassFunction<Number>
Returns:
The entropy of the values in the histogram.

getProbabilityFunction

public BinomialDistribution.PMF getProbabilityFunction()
Description copied from interface: ComputableDistribution
Gets the distribution function associated with this Distribution, either the PDF or PMF.

Specified by:
getProbabilityFunction in interface ComputableDistribution<Number>
Specified by:
getProbabilityFunction in interface DiscreteDistribution<Number>
Specified by:
getProbabilityFunction in interface ProbabilityMassFunction<Number>
Overrides:
getProbabilityFunction in class BinomialDistribution
Returns:
Distribution function associated with this Distribution.