Chapter Contents |
Previous |
Next |
CALL RANTRI |
Category: | Random Number |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
CALL RANTRI(seed,h,x); |
Range: | seed < 231 - 1 |
Note: | If seed 0, the time of day is used to initialize the seed stream. |
Range: | 0<h<1 |
Details |
The CALL RANTRI routine updates seed and returns a variate x generated from a triangular distribution on the interval (0,1) with parameter h, which is the modal value of the distribution.
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.
The CALL RANTRI routine uses an inverse transform method applied to a RANUNI uniform variate.
Comparisons |
The CALL RANTRI routine gives greater control of the seed and random number streams than does the RANTRI function.
Examples |
This example uses the CALL RANTRI routine:
options nodate pageno=1 linesize=80 pagesize=60; data case; retain Seed_1 Seed_2 Seed_3 45; h=.2; do i=1 to 10; call rantri(Seed_1,h,X1); call rantri(Seed_2,h,X2); X3=rantri(Seed_3,h); 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 RANTRI Example shows the results.
The SAS System 1 i Seed_1 Seed_2 Seed_3 X1 X2 X3 1 694315054 694315054 45 0.26424 0.26424 0.26424 2 1404437564 1404437564 45 0.47388 0.47388 0.47388 3 2130505156 2130505156 45 0.92047 0.92047 0.92047 4 1445125588 1445125588 45 0.48848 0.48848 0.48848 5 1013861398 18 18 0.35015 0.35015 0.35015 6 1326029789 707222751 18 0.44681 0.26751 0.44681 7 932142747 991271755 18 0.32713 0.34371 0.32713 8 1988843719 422705333 18 0.75690 0.19841 0.75690 9 516966271 1437043694 18 0.22063 0.48555 0.22063 10 2137808851 1264538018 18 0.93997 0.42648 0.93997 |
Changing Seed_2 for the CALL RANTRI 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 RANTRI function has, however, no effect.
See Also |
Function:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.