Class DistGeometric
- java.lang.Object
-
- nl.tudelft.simulation.jstats.distributions.Dist
-
- nl.tudelft.simulation.jstats.distributions.DistDiscrete
-
- nl.tudelft.simulation.jstats.distributions.DistGeometric
-
- All Implemented Interfaces:
Serializable
public class DistGeometric extends DistDiscrete
The Geometric distribution. The geometric distribution is the only discrete memoryless random distribution. It is a discrete analog of the exponential distribution. There are two variants, one that indicates the number of Bernoulli trials to get the first success (1, 2, 3, ...), and one that indicates the number of failures before the first success (0, 1, 2, ...). In line with Law & Kelton, the version of the number of failures before the first success is modeled here, so X ={0, 1, 2, ...}. For more information on this distribution see https://mathworld.wolfram.com/GeometricDistribution.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 DistGeometric(StreamInterface stream, double p)Construct a new geometric distribution for a repeated set of Bernoulli trials, indicating the number of failures before the first success.
-
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.doubleprobability(long observation)returns the probability of the observation in this particular distribution.StringtoString()
-
-
-
Constructor Detail
-
DistGeometric
public DistGeometric(StreamInterface stream, double p)
Construct a new geometric distribution for a repeated set of Bernoulli trials, indicating the number of failures before the first success.- Parameters:
stream- StreamInterface; the random number streamp- double; the probability of success for each individual trial- Throws:
IllegalArgumentException- when 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.
-
getP
public double getP()
Return the probability of success for each individual trial.- Returns:
- double; the probability of success for each individual trial
-
-