- Function Geometric(ProbabilityOfSuccess)
Geometric
The function Geometric
draws a random value from a geometric
distribution.
It represents the number of failures in a series of drawings whereby the chance of success is ProbabilityOfSuccess
Geometric(
ProbabilityOfSuccess ! (input) numerical expression
)
Arguments
- ProbabilityOfSuccess
A scalar numerical expression in the range \((0,1)\).
Return Value
The function
Geometric
returns a random value drawn from a geometric distribution with a probability of success ProbabilityOfSuccess.
Graph
A graph with:
a histogram for 10000 experiments of drawing from distribution
Geometric(0.1)
, andthe
DistributionDensity
forGeometric(0.1)
Example
The code:
option seed := 1234 ;
_p_draw := Geometric( 0.1 );
_p_pointDensity := DistributionDensity( Geometric( 0.1 ), 5 );
block where listing_number_precision := 6 ;
display _p_draw, _p_pointDensity ;
endblock ;
will produce
_p_draw := 7 ;
_p_pointDensity := 0.059049 ;
in the listing file.
Indicates:
that for the first drawing: 7 failures before success, when chance of success is 0.1, and
the probability for result 5 is 0.059049.
References
The
Geometric
distribution is discussed in full detail in Discrete Distributions of the Language Reference.