Chapter Contents |
Previous |
Next |
CALL RANPOI |
Category: | Random Number |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
CALL RANPOI(seed,m,x); |
Range: | seed < 231 - 1 |
Note: | If seed 0, the time of day is used to initialize the seed stream. |
Range: | m 0 |
Details |
The CALL RANPOI routine updates seed and returns a variate x that is generated from a Poisson distribution, with mean m.
By adjusting the seeds, you can force streams of variates to agree or disagree for some or all of the observations in the same, or in subsequent, DATA steps.
For m< 85, an inverse transform method applied to a RANUNI uniform variate is used. (Fishman 1976) (See References). For m 85, the normal approximation of a Poisson random variable is used. To expedite execution, internal variables are calculated only on initial calls (that is, with each new m).
Comparisons |
The CALL RANPOI routine gives greater control of the seed and random number streams than does the RANPOI function.
Examples |
This example uses the CALL RANPOI routine:
options nodate pageno=1 linesize=80 pagesize=60; data case; retain Seed_1 Seed_2 Seed_3 45; m=120; do i=1 to 10; call ranpoi(Seed_1,m,X1); call ranpoi(Seed_2,m,X2); X3=ranpoi(Seed_3,m); if i=5 then do; Seed_2=18; Seed_3=18; end; output; end; run; proc print; id i; var Seed_1-Seed_3 X1-X3; run;
The RANPOI Example shows the results.
The SAS System 1 i Seed_1 Seed_2 Seed_3 X1 X2 X3 1 1404437564 1404437564 45 111 111 111 2 1445125588 1445125588 45 119 119 119 3 1326029789 1326029789 45 110 110 110 4 1988843719 1988843719 45 133 133 133 5 2137808851 18 18 138 138 138 6 1233028129 991271755 18 115 104 115 7 50049159 1437043694 18 135 110 135 8 802575599 959908645 18 102 109 102 9 100573943 1225034217 18 137 113 137 10 414117170 425626811 18 121 122 121 |
Changing Seed_2 for the CALL RANPOI statement, when I=5, forces the stream of the variates for X2 to deviate from the stream of the variates for X1. Changing Seed_3 on the RANPOI function, however, has no effect.
See Also |
Function:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.