SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | Static Public Member Functions | List of all members

The Pascal distribution is a special case of the negative binomial distribution [118]  (page 324) with parameters \(n\) and \(p\), where \(n\) is a positive integer and \(0\le p\le1\). More...

Inheritance diagram for PascalDist:
[legend]
Collaboration diagram for PascalDist:
[legend]

Public Member Functions

 PascalDist (int n, double p)
 Creates an object that contains the probability terms ( fmass-pascal ) and the distribution function for the Pascal distribution with parameter \(n\) and \(p\).
 
int getN1 ()
 Returns the parameter \(n\) of this object.
 
void setParams (int n, double p)
 Sets the parameter \(n\) and \(p\) of this object.
 
String toString ()
 Returns a String containing information about the current distribution.
 
- Public Member Functions inherited from NegativeBinomialDist
 NegativeBinomialDist (double n, double p)
 Creates an object that contains the probability terms ( fmass-negbin ) and the distribution function for the negative binomial distribution with parameters \(n\) and \(p\).
 
double prob (int x)
 
double cdf (int x)
 
double barF (int x)
 
int inverseFInt (double u)
 
double getMean ()
 Returns the mean of the distribution function.
 
double getVariance ()
 Returns the variance of the distribution function.
 
double getStandardDeviation ()
 Returns the standard deviation of the distribution function.
 
double getGamma ()
 Returns the parameter \(n\) of this object.
 
double getN ()
 Returns the parameter \(n\) of this object.
 
double getP ()
 Returns the parameter \(p\) of this object.
 
void setParams (double n, double p)
 Sets the parameter \(n\) and \(p\) of this object. More...
 
double [] getParams ()
 Return a table containing the parameters of the current distribution. More...
 
String toString ()
 Returns a String containing information about the current distribution.
 
- Public Member Functions inherited from DiscreteDistributionInt
abstract double prob (int x)
 Returns \(p(x)\), the probability of \(x\). More...
 
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
abstract double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function. More...
 
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 

Static Public Member Functions

static double [] getMLE (int[] x, int m)
 Estimates the parameter \((n, p)\) of the Pascal distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static PascalDist getInstanceFromMLE (int[] x, int m)
 Creates a new instance of a Pascal distribution with parameters \(n\) and \(p\) estimated using the maximum likelihood method based on the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
- Static Public Member Functions inherited from NegativeBinomialDist
static double prob (double n, double p, int x)
 Computes the probability \(p(x)\) defined in ( fmass-negbin ).
 
static double cdf (double n, double p, int x)
 Computes the distribution function.
 
static double barF (double n, double p, int x)
 Returns \(\bar{F}(x) = P[X \ge x]\), the complementary distribution function.
 
static int inverseF (double n, double p, double u)
 Computes the inverse function without precomputing tables.
 
static double [] getMLE (int[] x, int m, double n)
 Estimates the parameter \(p\) of the negative binomial distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static NegativeBinomialDist getInstanceFromMLE (int[] x, int m, double n)
 Creates a new instance of a negative binomial distribution with parameters \(n\) given and \(\hat{p}\) estimated using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static double [] getMLE1 (int[] x, int m, double p)
 Estimates the parameter \(n\) of the negative binomial distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static NegativeBinomialDist getInstanceFromMLE1 (int[] x, int m, double p)
 Creates a new instance of a negative binomial distribution with parameters \(p\) given and \(\hat{n}\) estimated using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static double [] getMLE (int[] x, int m)
 Estimates the parameter \((n, p)\) of the negative binomial distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static NegativeBinomialDist getInstanceFromMLE (int[] x, int m)
 Creates a new instance of a negative binomial distribution with parameters \(n\) and \(p\) estimated using the maximum likelihood method based on the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static double getMLEninv (int[] x, int m)
 Estimates and returns the parameter \(\nu= 1/\hat{n}\) of the negative binomial distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\). More...
 
static double getMean (double n, double p)
 Computes and returns the mean \(E[X] = n(1 - p)/p\) of the negative binomial distribution with parameters \(n\) and \(p\). More...
 
static double getVariance (double n, double p)
 Computes and returns the variance \(\mbox{Var}[X] = n(1 - p)/p^2\) of the negative binomial distribution with parameters \(n\) and \(p\). More...
 
static double getStandardDeviation (double n, double p)
 Computes and returns the standard deviation of the negative binomial distribution with parameters \(n\) and \(p\). More...
 

Additional Inherited Members

- Static Public Attributes inherited from NegativeBinomialDist
static double MAXN = 100000
 If the maximum term is greater than this constant, then the tables will not be precomputed.
 
- Static Public Attributes inherited from DiscreteDistributionInt
static double EPSILON = 1.0e-16
 Environment variable that determines what probability terms can be considered as negligible when building precomputed tables for distribution and mass functions. More...
 
- Protected Attributes inherited from NegativeBinomialDist
double n
 
double p
 
- Protected Attributes inherited from DiscreteDistributionInt
double cdf [] = null
 
double pdf [] = null
 
int xmin = 0
 
int xmax = 0
 
int xmed = 0
 
int supportA = Integer.MIN_VALUE
 
int supportB = Integer.MAX_VALUE
 
- Static Protected Attributes inherited from DiscreteDistributionInt
static final double EPS_EXTRA = 1.0e-6
 

Detailed Description

The Pascal distribution is a special case of the negative binomial distribution [118]  (page 324) with parameters \(n\) and \(p\), where \(n\) is a positive integer and \(0\le p\le1\).

Its mass function is

\[ p(x) = \binom{n + x - 1}{x} p^n (1 - p)^x, \qquad\mbox{for } x = 0, 1, 2, …\tag{fmass-pascal} \]

This \(p(x)\) can be interpreted as the probability of having \(x\) failures before the \(n\)th success in a sequence of independent Bernoulli trials with probability of success \(p\). For \(n=1\), this gives the geometric distribution.

Member Function Documentation

◆ getInstanceFromMLE()

static PascalDist getInstanceFromMLE ( int []  x,
int  m 
)
static

Creates a new instance of a Pascal distribution with parameters \(n\) and \(p\) estimated using the maximum likelihood method based on the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\).

Parameters
xthe list of observations to use to evaluate parameters
mthe number of observations to use to evaluate parameters

◆ getMLE()

static double [] getMLE ( int []  x,
int  m 
)
static

Estimates the parameter \((n, p)\) of the Pascal distribution using the maximum likelihood method, from the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\).

The estimates are returned in a two-element array, in regular order: [ \(n\), \(p\)]. The maximum likelihood estimators are the values \((\hat{n}\), \(\hat{p})\) that satisfy the equations

\begin{align*} \frac{\hat{n}(1 - \hat{p})}{\hat{p}} & = \bar{x}_m \\ \ln(1 + \hat{p}) & = \sum_{j=1}^{\infty} \frac{F_j}{(\hat{n} + j - 1)} \end{align*}

where \(\bar{x}_m\) is the average of \(x[0],…,x[m-1]\), and \(F_j = \sum_{i=j}^{\infty} f_i\) = proportion of \(x\)’s which are greater than or equal to \(j\) [97]  (page 132).

Parameters
xthe list of observations used to evaluate parameters
mthe number of observations used to evaluate parameters
Returns
returns the parameters [ \(\hat{n}\), \(\hat{p}\)]

The documentation for this class was generated from the following file: