## edu.ucla.stat.SOCR.distributions Class NegativeBinomialDistribution

```java.lang.Object
edu.ucla.stat.SOCR.core.SOCRValueSettable
edu.ucla.stat.SOCR.core.Distribution
edu.ucla.stat.SOCR.distributions.NegativeBinomialDistribution
```
All Implemented Interfaces:
IValueSettable, Pluginable, java.util.Observer
Direct Known Subclasses:
GeometricDistribution

`public class NegativeBinomialDistributionextends Distribution`

This class models the negative binomial distribution with specified successes parameter and probability parameter. http://mathworld.wolfram.com/NegativeBinomialDistribution.html .

Field Summary

Fields inherited from class edu.ucla.stat.SOCR.core.Distribution
`applet, CONTINUOUS, DISCRETE, MAXMGFXVAL, MAXMGFYVAL, MINMGFXVAL, MIXED, name`

Constructor Summary
`NegativeBinomialDistribution()`
Default Constructor: creates a new negative binomial distribution with successes parameter 1 and probability parameter 0.5,
```NegativeBinomialDistribution(int k, double p)```
General Constructor: creates a new negative binomial distribution with given parameter values.

Method Summary
` double` `getDensity(double x)`
Density function
` double` `getMaxDensity()`
Maximum value of getDensity function
` double` `getMean()`
Mean
` double` `getMGF(double t)`
Computes the moment generating function in closed form for a parameter t which lies in the domain of the distribution.
` java.lang.String` `getOnlineDescription()`
This method returns an online description of this distribution.
` double` `getPGF(double t)`
Computes the moment generating function in closed form for a parameter t which lies in the domain of the distribution.
` double` `getProbability()`
Get the probability parameter
` int` `getSuccesses()`
Get the successes parameter
` double` `getVariance()`
Variance
` void` `initialize()`
used for some subclass to initialize before being used
` void` ```setParameters(int k, double p)```
This method set the paramters and the set of values.
` void` `setProbability(double p)`
Set the probability parameters
` void` `setSuccesses(int k)`
Set the successes parameters
` double` `simulate()`
Simulate a value
` void` `valueChanged()`

Methods inherited from class edu.ucla.stat.SOCR.core.Distribution
`addObserver, betaCDF, comb, factorial, findGFRoot, findRoot, gamma, gammaCDF, getCDF, getDisplayPane, getDomain, getFailureRate, getGFDerivative, getGFSecondDerivative, getInstance, getLocalHelp, getMean, getMedian, getMgfDomain, getName, getPGFDomain, getQuantile, getSampleMoment, getSD, getSOCRDistributionFunctors, getSOCRDistributions, getType, getVariance, inverseCDF, logGamma, paramEstimate, perm, sampleMean, sampleVar, setApplet, setDomain, setDomain, setMGFDomain, setMGFDomain, setMGFParameters, setMGFParameters, setMGFParameters, setMGFParameters, setParameters, setPGFDomain, setPGFDomain, setPGFParameters, setPGFParameters, setPGFParameters, setPGFParameters, update, valueChanged`

Methods inherited from class edu.ucla.stat.SOCR.core.SOCRValueSettable
`createComponentSetter, createValueSetter, createValueSetter, createValueSetter, createValueSetter, getComponentSetter, getComponentSetters, getValueSetter, getValueSetters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NegativeBinomialDistribution

```public NegativeBinomialDistribution(int k,
double p)```
General Constructor: creates a new negative binomial distribution with given parameter values.

### NegativeBinomialDistribution

`public NegativeBinomialDistribution()`
Default Constructor: creates a new negative binomial distribution with successes parameter 1 and probability parameter 0.5,

Method Detail

### initialize

`public void initialize()`
Description copied from class: `Distribution`
used for some subclass to initialize before being used

Overrides:
`initialize` in class `Distribution`

### valueChanged

`public void valueChanged()`
Overrides:
`valueChanged` in class `Distribution`

### setParameters

```public void setParameters(int k,
double p)```
This method set the paramters and the set of values.

### setSuccesses

`public void setSuccesses(int k)`
Set the successes parameters

### getSuccesses

`public int getSuccesses()`
Get the successes parameter

### getProbability

`public double getProbability()`
Get the probability parameter

### setProbability

`public void setProbability(double p)`
Set the probability parameters

### getDensity

`public double getDensity(double x)`
Density function

Specified by:
`getDensity` in class `Distribution`

### getMaxDensity

`public double getMaxDensity()`
Maximum value of getDensity function

Overrides:
`getMaxDensity` in class `Distribution`

### getMean

`public double getMean()`
Mean

Overrides:
`getMean` in class `Distribution`

### getVariance

`public double getVariance()`
Variance

Overrides:
`getVariance` in class `Distribution`

### simulate

`public double simulate()`
Simulate a value

Overrides:
`simulate` in class `Distribution`

### getMGF

```public double getMGF(double t)
throws ParameterOutOfBoundsException```
Computes the moment generating function in closed form for a parameter t which lies in the domain of the distribution.

Overrides:
`getMGF` in class `Distribution`
Throws:
`ParameterOutOfBoundsException`

### getPGF

`public double getPGF(double t)`
Computes the moment generating function in closed form for a parameter t which lies in the domain of the distribution.

Overrides:
`getPGF` in class `Distribution`

### getOnlineDescription

`public java.lang.String getOnlineDescription()`
This method returns an online description of this distribution.

Overrides:
`getOnlineDescription` in class `Distribution`