org.jscience.mathematics.statistics
Class GeometricDistribution

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

public class GeometricDistribution
extends NegativeBinomialDistribution
implements java.io.Serializable

This class models the geometric distribution with a given success probability. This distribution models the trial number of the first success in a sequence of Bernoulli trials.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jscience.mathematics.statistics.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
GeometricDistribution()
          This default constructor creates a new geometric distribution with parameter 0.5
GeometricDistribution(double p)
          This general constructor creates a new geometric distribution with a specified success probabilitiy
 
Method Summary
 double getFactorialMoment(int k)
          This method computes the factorial moment of a specified order.
 void setParameters(int k, double p)
          This method sets the negative binomial parameters, and ensures that the number of successes is set at 1.
 void setSuccesses(int k)
          This method ensures that the number of successes is set at 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.NegativeBinomialDistribution
getDensity, getMaxDensity, getMean, getMGF, getPGF, getProbability, getSuccesses, getVariance, setProbability, simulate
 
Methods inherited from class org.jscience.mathematics.statistics.Distribution
getCDF, 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

GeometricDistribution

public GeometricDistribution(double p)
This general constructor creates a new geometric distribution with a specified success probabilitiy

Parameters:
p - the success probability

GeometricDistribution

public GeometricDistribution()
This default constructor creates a new geometric distribution with parameter 0.5

Method Detail

getFactorialMoment

public double getFactorialMoment(int k)
This method computes the factorial moment of a specified order.

Parameters:
k - the order
Returns:
the factorial moment of order k

setSuccesses

public void setSuccesses(int k)
This method ensures that the number of successes is set at 1.

Overrides:
setSuccesses in class NegativeBinomialDistribution
Parameters:
k - the number of successes

setParameters

public void setParameters(int k,
                          double p)
This method sets the negative binomial parameters, and ensures that the number of successes is set at 1.

Overrides:
setParameters in class NegativeBinomialDistribution
Parameters:
k - the number of successes
p - the probability of success

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 NegativeBinomialDistribution
Returns:
a string giving the name of the distribution and the values of the parameters