|Tools & Models| |Harvest Project|
[Top] [Contents] [Prev] [Next]

Appendix A. Computer algorithm for generating binomial random variable.

Let

p : probability of success;

n : number of trials;

X : random number (0 £ X < 1);

m : binomial random value (output of routine).

Step 1. Compute the upper and lower bounds for the random variable:

Step 2. Use the lower bound as a seed value and compute the density using Stirling's Approximation.


By Stirling's Approximation,

Step 3. Set the distribution equal to the density.

Step 4. Loop to locate binomial random variable.

While ((m < Upper Bound) and (Dist < X))
m = m + 1
Den = (Den) (p(n - m + 1))/((1 - p)m)
Dist = Dist + Den
End

[Top] [Contents] [Prev] [Next]
Selective Fishery Simulation Model Specifications