SSJ
V. labo.

umontreal.iro.lecuyer.probdist
Class NegativeBinomialDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
      extended by umontreal.iro.lecuyer.probdist.NegativeBinomialDist
All Implemented Interfaces:
Distribution
Direct Known Subclasses:
PascalDist

public class NegativeBinomialDist
extends DiscreteDistributionInt

. \begin{detailed}
 \par
 \end{detailed}


Field Summary
static double MAXN
          .
 
Fields inherited from class umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
EPSILON
 
Constructor Summary
NegativeBinomialDist(double n, double p)
          .
 
Method Summary
static double barF(double n, double p, int x)
          .
 double barF(int x)
          Returns bar(F)(x), the complementary distribution function.
static double cdf(double n, double p, int x)
          .
 double cdf(int x)
          Returns the distribution function F evaluated at x (see).
 double getGamma()
          Deprecated. 
static NegativeBinomialDist getInstanceFromMLE(int[] x, int m)
          .
static NegativeBinomialDist getInstanceFromMLE(int[] x, int m, double n)
          .
static NegativeBinomialDist getInstanceFromMLE1(int[] x, int m, double p)
          .
 double getMean()
          .
static double getMean(double n, double p)
          .
static double[] getMLE(int[] x, int m)
          .
static double[] getMLE(int[] x, int m, double n)
          .
static double[] getMLE1(int[] x, int m, double p)
          .
static double getMLEninv(int[] x, int m)
          .
 double getN()
          .
 double getP()
          .
 double[] getParams()
          .
 double getStandardDeviation()
          .
static double getStandardDeviation(double n, double p)
          .
 double getVariance()
          .
static double getVariance(double n, double p)
          .
static int inverseF(double n, double p, double u)
          .
 int inverseFInt(double u)
          Returns the inverse distribution function F-1(u), where 0 <= u <= 1.
static double prob(double n, double p, int x)
          .
 double prob(int x)
          Returns p(x), the probability of x.
 void setParams(double n, double p)
          .
 String toString()
          .
 
Methods inherited from class umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
barF, cdf, getXinf, getXsup, inverseF
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXN

public static double MAXN
. \begin{detailed}
 \par
 \begin{tabb}If the maximum term is greater than this constant,
 then the tables will {\em not\/} be precomputed.
 \end{tabb}\end{detailed}

Constructor Detail

NegativeBinomialDist

public NegativeBinomialDist(double n,
                            double p)
. \begin{tabb}
 Creates an object that contains the probability
 terms and the dis...
 ...or
 the negative binomial distribution with parameters $n$\ and $p$.
 \end{tabb}

Method Detail

prob

public double prob(int x)
Description copied from class: DiscreteDistributionInt
Returns p(x), the probability of x.

Specified by:
prob in class DiscreteDistributionInt
Parameters:
x - value at which the mass function must be evaluated
Returns:
the mass function evaluated at x

cdf

public double cdf(int x)
Description copied from class: DiscreteDistributionInt
Returns the distribution function F evaluated at x (see).

Specified by:
cdf in class DiscreteDistributionInt
Parameters:
x - value at which the distribution function must be evaluated
Returns:
the distribution function evaluated at x

barF

public double barF(int x)
Description copied from class: DiscreteDistributionInt
Returns bar(F)(x), the complementary distribution function. See the WARNING above.

Overrides:
barF in class DiscreteDistributionInt
Parameters:
x - value at which the complementary distribution function must be evaluated
Returns:
the complementary distribution function evaluated at x

inverseFInt

public int inverseFInt(double u)
Description copied from class: DiscreteDistributionInt
Returns the inverse distribution function F-1(u), where 0 <= u <= 1. The default implementation uses binary search.

Overrides:
inverseFInt in class DiscreteDistributionInt
Parameters:
u - value in the interval (0, 1) for which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

getMean

public double getMean()
Description copied from interface: Distribution
. \begin{tabb}Returns the mean of the distribution function.
 \end{tabb}


getVariance

public double getVariance()
Description copied from interface: Distribution
. \begin{tabb}Returns the variance of the distribution function.
 \end{tabb}


getStandardDeviation

public double getStandardDeviation()
Description copied from interface: Distribution
. \begin{tabb}Returns the standard deviation of the distribution function.
 \end{tabb}


prob

public static double prob(double n,
                          double p,
                          int x)
. \begin{tabb}
 Computes the probability $p(x)$%
 .
 \end{tabb}


cdf

public static double cdf(double n,
                         double p,
                         int x)
. \begin{tabb}Computes the distribution function.
 \end{tabb}


barF

public static double barF(double n,
                          double p,
                          int x)
. \begin{tabb}Returns $\bar F(x) = P[X \ge x]$, the complementary
 distribution function.
 \end{tabb}


inverseF

public static int inverseF(double n,
                           double p,
                           double u)
. \begin{tabb}Computes the inverse function without precomputing tables.
 \end{tabb}


getMLE

public static double[] getMLE(int[] x,
                              int m,
                              double n)
. \begin{tabb}
 Estimates the parameter $p$\ of the negative binomial distribution...
 ...x}_m)$,
 where $\bar{x}_m$\ is the average of $x[0], \ldots, x[m-1]$.
 \end{tabb}
xthe list of observations used to evaluate parameters mthe number of observations used to evaluate parameters nthe first parameter of the negative binomial returns the parameters [$ \hat{{p}}$]


getInstanceFromMLE

public static NegativeBinomialDist getInstanceFromMLE(int[] x,
                                                      int m,
                                                      double n)
. \begin{tabb}
 Creates a new instance of a negative binomial distribution with pa...
 ... method, from the $m$\ observations $x[i]$,
 $i = 0, 1, \ldots, m-1$.
 \end{tabb}
xthe list of observations to use to evaluate parameters mthe number of observations to use to evaluate parameters nthe first parameter of the negative binomial


getMLE1

public static double[] getMLE1(int[] x,
                               int m,
                               double p)
. \begin{tabb}
 Estimates the parameter $n$\ of the negative binomial distribution...
 ...Gamma function $\psi(x) = \Gamma^\prime(x)/\Gamma(x)$.
 \end{detailed}\end{tabb}
xthe list of observations used to evaluate parameters mthe number of observations used to evaluate parameters pthe second parameter of the negative binomial returns the parameters [$ \hat{{n}}$]


getInstanceFromMLE1

public static NegativeBinomialDist getInstanceFromMLE1(int[] x,
                                                       int m,
                                                       double p)
. \begin{tabb}
 Creates a new instance of a negative binomial distribution with pa...
 ... method, from the $m$\ observations $x[i]$,
 $i = 0, 1, \ldots, m-1$.
 \end{tabb}
xthe list of observations to use to evaluate parameters mthe number of observations to use to evaluate parameters pthe second parameter of the negative binomial


getMLE

public static double[] getMLE(int[] x,
                              int m)
. \begin{tabb}
 Estimates the parameter $(n, p)$\ of the negative binomial distrib...
 ... number of $x_i \ge j$\ (see\cite[page 132]{tJOH69a}).
 \end{detailed}\end{tabb}
xthe list of observations used to evaluate parameters mthe number of observations used to evaluate parameters returns the parameters [[tex2html_wrap_inline477], [tex2html_wrap_inline479]]


getInstanceFromMLE

public static NegativeBinomialDist getInstanceFromMLE(int[] x,
                                                      int m)
. \begin{tabb}
 Creates a new instance of a negative binomial distribution with
 p...
 ...thod
 based on the $m$\ observations $x[i]$, $i = 0, 1, \ldots, m-1$.
 \end{tabb}
xthe list of observations to use to evaluate parameters mthe number of observations used to evaluate parameters


getMLEninv

public static double getMLEninv(int[] x,
                                int m)
. \begin{tabb}
 Estimates and returns the parameter $\nu = 1/\hat{n}$
 of the nega...
 ... number of $x_i \ge j$\ (see\cite[page 132]{tJOH69a}).
 \end{detailed}\end{tabb}
xthe list of observations used to evaluate parameter mthe number of observations used to evaluate parameter returns the parameter ν


getMean

public static double getMean(double n,
                             double p)
. \begin{tabb}Computes and returns the mean $E[X] = n(1 - p)/p$
 of the negative binomial distribution with parameters $n$\ and $p$.
 \end{tabb}
the mean of the negative binomial distribution E[X] = n(1 - p)/p


getVariance

public static double getVariance(double n,
                                 double p)
. \begin{tabb}Computes and returns the variance $\mbox{Var}[X] = n(1
 - p)/p^2$
 of the negative binomial distribution with parameters $n$\ and $p$.
 \end{tabb}
the variance of the negative binomial distribution Var[X] = n(1 - p)/p2


getStandardDeviation

public static double getStandardDeviation(double n,
                                          double p)
. \begin{tabb}Computes and returns the standard deviation of the negative
 binomial distribution with parameters $n$\ and $p$.
 \end{tabb}
the standard deviation of the negative binomial distribution
 


getGamma

@Deprecated
public double getGamma()
Deprecated. 

. \begin{hide}
 \par
 \begin{tabb}Returns the parameter $n$\ of this object.
 \end{tabb}\end{hide}


getN

public double getN()
. \begin{tabb}Returns the parameter $n$\ of this object.
 \end{tabb}


getP

public double getP()
. \begin{tabb}Returns the parameter $p$\ of this object.
 \end{tabb}


setParams

public void setParams(double n,
                      double p)
. \begin{tabb}Sets the parameter $n$\ and $p$\ of this object.
 \end{tabb}


getParams

public double[] getParams()
. \begin{tabb}
 Return a table containing the parameters of the current distribution.
 This table is put in regular order: [$n$, $p$].
 \end{tabb}

 


toString

public String toString()
. \begin{hide}
 \par
 \begin{tabb}
 Returns a \texttt{String} containing information about the current distribution.
 \end{tabb}\end{hide}

Overrides:
toString in class Object

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.