Class DistNegBinomial
- java.lang.Object
-
- nl.tudelft.simulation.jstats.distributions.Dist
-
- nl.tudelft.simulation.jstats.distributions.DistDiscrete
-
- nl.tudelft.simulation.jstats.distributions.DistNegBinomial
-
- All Implemented Interfaces:
Serializable
public class DistNegBinomial extends DistDiscrete
The Negative Binomial distribution. It is also known as the Pascal distribution or Pólya distribution. It gives the probability of x failures where there are s-1 successes in a total of x+s-1 Bernoulli trials, and trial (x+s) is a success. The chance for success is p for each trial. For more information on this distribution see https://mathworld.wolfram.com/NegativeBinomialDistribution.htmlCopyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Peter Jacobs , Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DistNegBinomial(StreamInterface stream, int s, double p)constructs a new negative binomial distribution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longdraw()draws the next long from the stream.doublegetP()Return the probability of success for each individual trial in the negative binomial distribution.intgetS()Return the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success.doubleprobability(long observation)returns the probability of the observation in this particular distribution.StringtoString()
-
-
-
Constructor Detail
-
DistNegBinomial
public DistNegBinomial(StreamInterface stream, int s, double p)
constructs a new negative binomial distribution.- Parameters:
stream- StreamInterface; the random number streams- int; the number of successes in the sequence of (x+n) trials, where trial (x+n) is a successp- double; the probability of success for each individual trial in the negative binomial distribution- Throws:
IllegalArgumentException- when s <= 0 or p <= 0 or p >= 1
-
-
Method Detail
-
draw
public long draw()
draws the next long from the stream.- Specified by:
drawin classDistDiscrete- Returns:
- long
-
probability
public double probability(long observation)
returns the probability of the observation in this particular distribution.- Specified by:
probabilityin classDistDiscrete- Parameters:
observation- long; the discrete observation.- Returns:
- double the probability.
-
getS
public int getS()
Return the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success.- Returns:
- int; the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success
-
getP
public double getP()
Return the probability of success for each individual trial in the negative binomial distribution.- Returns:
- double; the probability of success for each individual trial in the negative binomial distribution
-
-