- Function Binomial(ProbabilityOfSuccess, NumberOfTries)
Binomial
The function Binomial
draws a random value from a binomial
distribution.
Binomial(
ProbabilityOfSuccess, ! (input) numerical expression
NumberOfTries ! (input) integer expression
)
Arguments
- ProbabilityOfSuccess
A scalar numerical expression in range \((0,1)\).
- NumberOfTries
An integer numerical expression \(> 0\).
Return Value
The function
Binomial
returns a random value drawn from a binomial distribution with a probability of success ProbabilityOfSuccess and number of tries NumberOfTries
Graph
A graph with:
a histogram for 1000 experiments of drawing from distribution
Binomial(0.5,50)
, andthe
DistributionDensity
forBinomial(0.5,50)
Example
The code:
option seed := 1234 ;
_p_draw := Binomial( 0.7, 50 );
_p_pointDensity := DistributionDensity( Binomial( 0.7, 50 ), 25 );
block where listing_number_precision := 6 ;
display _p_draw, _p_pointDensity ;
endblock ;
will produce
_p_draw := 37 ;
_p_pointDensity := 0.001436 ;
in the listing file.
References
The
Binomial
distribution is discussed in full detail in Discrete Distributions of the Language Reference.