org.jscience.mathematics.statistics
Class BernoulliDistribution

java.lang.Object
  extended by org.jscience.mathematics.statistics.Distribution
      extended by org.jscience.mathematics.statistics.BinomialDistribution
          extended by org.jscience.mathematics.statistics.BernoulliDistribution
All Implemented Interfaces:
java.io.Serializable

public class BernoulliDistribution
extends BinomialDistribution
implements java.io.Serializable

This class models the Bernoulli distribution with a specified parameter. This is the distribution of an indicator random variable (taking values 0 and 1).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jscience.mathematics.statistics.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
BernoulliDistribution()
          This default constructor creates a new Bernoulli distribution with parameter p = 0.5.
BernoulliDistribution(double p)
          This general constructor creates a new Bernoulli distribution with a specified parameter.
 
Method Summary
 double getMaxDensity()
          This method returns the maximum value of the probability density function.
 void setTrials(int n)
          This method sets the number of trials, which is always 1.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class org.jscience.mathematics.statistics.BinomialDistribution
getCDF, getDensity, getFactorialMoment, getMean, getMGF, getPGF, getProbability, getTrials, getVariance, setParameters, setProbability, simulate
 
Methods inherited from class org.jscience.mathematics.statistics.Distribution
getDomain, getFailureRate, getMedian, getMoment, getMoment, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BernoulliDistribution

public BernoulliDistribution(double p)
This general constructor creates a new Bernoulli distribution with a specified parameter.

Parameters:
p - the probaiblity of 1

BernoulliDistribution

public BernoulliDistribution()
This default constructor creates a new Bernoulli distribution with parameter p = 0.5.

Method Detail

getMaxDensity

public double getMaxDensity()
This method returns the maximum value of the probability density function.

Overrides:
getMaxDensity in class BinomialDistribution
Returns:
the maximum value of the probability density function

setTrials

public void setTrials(int n)
This method sets the number of trials, which is always 1.

Overrides:
setTrials in class BinomialDistribution
Parameters:
n - the number of trials.

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class BinomialDistribution
Returns:
a string giving the name of the distribution and the values of the parameters