Previous Page | Next Page

Functions and CALL Routines

CALL RANPOI Routine



Returns a random variate from a Poisson distribution.
Category: Random Number

Syntax
Arguments
Details
Comparisons
Examples
See Also

Syntax

CALL RANPOI(seed,m,x);

Arguments

seed

is the seed value. A new value for seed is returned each time CALL RANPOI is executed.

Range: seed < 231 - 1
Note: If seed [le] 0, the time of day is used to initialize the seed stream.
See: Seed Values and Comparison of Seed Values in Random-Number Functions and CALL Routines for more information about seed values
m

is a numeric mean parameter.

Range: m [equation]0
x

is a numeric variable. A new value for the random variate x is returned each time CALL RANPOI is executed.


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 in References). For m [ge] 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).

For a discussion and example of an effective use of the random number CALL routines, see Starting, Stopping, and Restarting a Stream.


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 pageno=1 ls=80 ps=64 nodate;

data u1(keep=x);
   seed = 104;
   do i = 1 to 5;
      call ranpoi(seed, 2000, x); 
      output;
   end;
   call symputx('seed', seed);
run;

data u2(keep=x);
   seed = &seed;
   do i = 1 to 5;
      call ranpoi(seed, 2000, x); 
      output;
   end;
run;

data all;
   set u1 u2;
   z = ranpoi(104, 2000);
run;

proc print label;
   label x = 'Separate Streams' z = 'Single Stream';
run;

Output from the CALL RANPOI Routine

                                 The SAS System                                1

                                  Separate    Single
                           Obs     Streams    Stream

                             1      2058       2058 
                             2      2046       2046 
                             3      2009       2009 
                             4      1984       1984 
                             5      2073       2073 
                             6      1921       1921 
                             7      2034       2034 
                             8      2042       2042 
                             9      2001       2001 
                            10      1957       1957 

See Also

Functions:

RAND Function

RANPOI Function

Previous Page | Next Page | Top of Page