edu.uah.math.distributions
Class NegativeBinomialDistribution

java.lang.Object
  extended by edu.uah.math.distributions.Distribution
      extended by edu.uah.math.distributions.NegativeBinomialDistribution
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
GeometricDistribution

public class NegativeBinomialDistribution
extends Distribution
implements java.io.Serializable

This class models the negative binomial distribution with specified successes parameter and probability parameter.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.uah.math.distributions.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
NegativeBinomialDistribution()
          This default constructor creates a new negative binomial distribution with successes parameter 1 and probability parameter 0.5.
NegativeBinomialDistribution(int k, double p)
          This general constructor creates a new negative binomial distribution with given parameter values.
 
Method Summary
 double getDensity(double x)
          This method computes the probability density function.
 double getMaxDensity()
          This method computes the maximum value of the density function.
 double getMean()
          This method computes the mean of the distribution.
 double getMGF(double t)
          This method computes moment generating function.
 double getPGF(double t)
          This method computes the probability generating function.
 double getProbability()
          This method returns the probability parameter.
 int getSuccesses()
          This method returns the successes parameter.
 double getVariance()
          This method computes the variance of the distribution.
 void setParameters(int k, double p)
          This method set the paramters and the default domain.
 void setProbability(double p)
          This method sets the probability parameter.
 void setSuccesses(int k)
          This method set the successes parameter.
 double simulate()
          This method simulates a value from the distribution, overriding the correspondin default method in Distribution.
 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 edu.uah.math.distributions.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

NegativeBinomialDistribution

public NegativeBinomialDistribution(int k,
                                    double p)
This general constructor creates a new negative binomial distribution with given parameter values.

Parameters:
k - the number of successes
p - the probability of success

NegativeBinomialDistribution

public NegativeBinomialDistribution()
This default constructor creates a new negative binomial distribution with successes parameter 1 and probability parameter 0.5.

Method Detail

setParameters

public void setParameters(int k,
                          double p)
This method set the paramters and the default domain.

Parameters:
k - the number of successes
p - the probability of success

setSuccesses

public void setSuccesses(int k)
This method set the successes parameter.

Parameters:
k - the number of successes

getSuccesses

public int getSuccesses()
This method returns the successes parameter.

Returns:
the number of successes

getProbability

public double getProbability()
This method returns the probability parameter.

Returns:
the probability of success

setProbability

public void setProbability(double p)
This method sets the probability parameter.

Parameters:
p - the probability of success

getDensity

public double getDensity(double x)
This method computes the probability density function.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the probability density at x

getMaxDensity

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

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

getMean

public double getMean()
This method computes the mean of the distribution.

Overrides:
getMean in class Distribution
Returns:
the mean

getVariance

public double getVariance()
This method computes the variance of the distribution.

Overrides:
getVariance in class Distribution
Returns:
the variance

getPGF

public double getPGF(double t)
This method computes the probability generating function.

Overrides:
getPGF in class Distribution
Parameters:
t - a real number
Returns:
the probability generating function at t

getMGF

public double getMGF(double t)
This method computes moment generating function.

Overrides:
getMGF in class Distribution
Parameters:
t - a real number
Returns:
the moment generating function

simulate

public double simulate()
This method simulates a value from the distribution, overriding the correspondin default method in Distribution.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

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