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
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.html
Copyright (c) 2002-2024 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:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDistGeometric
(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
Modifier and TypeMethodDescriptionlong
draw()
draws the next long from the stream.double
getP()
Return the probability of success for each individual trial.double
probability
(long observation) returns the probability of the observation in this particular distribution.toString()
-
Constructor Details
-
DistGeometric
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 Details
-
draw
public long draw()draws the next long from the stream.- Specified by:
draw
in classDistDiscrete
- Returns:
- long
-
probability
public double probability(long observation) returns the probability of the observation in this particular distribution.- Specified by:
probability
in 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
-
toString
-