Documentation of 'smile.stat.distribution.NegativeBinomialDistribution' Java class
NegativeBinomialDistribution
smile.stat.distribution

Class NegativeBinomialDistribution

  • All Implemented Interfaces:
    Distribution


    public class NegativeBinomialDistribution
    extends DiscreteDistribution
    Negative binomial distribution arises as the probability distribution of the number of successes in a series of independent and identically distributed Bernoulli trials needed to get a specified (non-random) number r of failures. If r is an integer, it is usually called Pascal distribution. Otherwise, it is often called Polya distribution for the real-valued case. When r = 1 we get the probability distribution of number of successes before the first failure, which is a geometric distribution.

    An alternative definition is that X is the total number of trials needed to get r failures, not simply the number of successes. This alternative parameterization can be used as an alternative to the Poisson distribution. It is especially useful for discrete data over an unbounded positive range whose sample variance exceeds the sample mean. If a Poisson distribution is used to model such data, the model mean and variance are equal. In that case, the observations are overdispersed with respect to the Poisson model. Since the negative binomial distribution has one more parameter than the Poisson, the second parameter can be used to adjust the variance independently of the mean. In the case of modest overdispersion, this may produce substantially similar results to an overdispersed Poisson distribution.

    The negative binomial distribution also arises as a continuous mixture of Poisson distributions where the mixing distribution of the Poisson rate is a gamma distribution. That is, we can view the negative binomial as a Poisson(λ) distribution, where λ is itself a random variable, distributed according to Γ(r, p/(1 - p)).

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double cdf(double k)
      Cumulative distribution function.
      double entropy()
      Shannon entropy.
      double logp(int k)
      The probability mass function in log scale.
      double mean()
      The mean of distribution.
      int npara()
      The number of parameters of the distribution.
      double p(int k)
      The probability mass function.
      double quantile(double p)
      The quantile, the probability to the left of quantile is p.
      double rand()
      Generates a random number following this distribution.
      double sd()
      The standard deviation of distribution.
      java.lang.String toString() 
      double var()
      The variance of distribution.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NegativeBinomialDistribution

        public NegativeBinomialDistribution(double r,
                                            double p)
        Constructor.
        Parameters:
        r - the number of failures until the experiment is stopped.
        p - success probability in each experiment.
    • Method Detail

      • npara

        public int npara()
        Description copied from interface: Distribution
        The number of parameters of the distribution.
      • mean

        public double mean()
        Description copied from interface: Distribution
        The mean of distribution.
      • var

        public double var()
        Description copied from interface: Distribution
        The variance of distribution.
      • sd

        public double sd()
        Description copied from interface: Distribution
        The standard deviation of distribution.
      • entropy

        public double entropy()
        Shannon entropy. Not supported.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • rand

        public double rand()
        Description copied from interface: Distribution
        Generates a random number following this distribution.
      • cdf

        public double cdf(double k)
        Description copied from interface: Distribution
        Cumulative distribution function. That is the probability to the left of x.
      • quantile

        public double quantile(double p)
        Description copied from interface: Distribution
        The quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.