CALL RANCAU Routine


Returns a random variate from a Cauchy distribution

Category: Random Number

Syntax

CALL RANCAU ( seed,x );

Arguments

seed

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

  • Range: seed < 2 31 -1

  • Note: If seed 0, the time of day is used to initialize the seed stream.

  • See: 'Seed Values' on page 257 for more information about seed values

x

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

Details

The CALL RANCAU routine updates seed and returns a variate x that is generated from a Cauchy distribution that has a location parameter of 0 and scale parameter of 1.

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.

An acceptance- rejection procedure applied to RANUNI uniform variates is used. If u and v are independent uniform (-1/2, 1/2) variables and u 2 + v 2 1/4, then u / v is a Cauchy variate.

Comparisons

The CALL RANCAU routine gives greater control of the seed and random number streams than does the RANCAU function.

Examples

This example uses the CALL RANCAU routine:

 options nodate pageno=1 linesize=80 pagesize=60;  data case;     retain Seed_1 Seed_2 Seed_3 45;     do i=1 to 10;        call rancau(Seed_1,X1);        call rancau(Seed_2,X2);        X3=rancau(Seed_3);        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 following output shows the results:

Output 4.7: The RANCAU Example
start example
 The SAS System                                     1    i         Seed_1          Seed_2    Seed_3         X1            X2           X3    1       1404437564    1404437564      45   1.14736   1.14736   1.14736    2       1326029789    1326029789      45   0.23735   0.23735   0.23735    3       1988843719    1988843719      45   0.15474   0.15474   0.15474    4       1233028129    1233028129      45         4.97935      4.97935      4.97935    5         50049159            18      18         0.20402      0.20402      0.20402    6        802575599     991271755      18         3.43645      4.44427      3.43645    7       1233458739    1437043694      18         6.32808   1.79200      6.32808    8         52428589     959908645      18         0.18815   1.67610      0.18815    9       1216356463    1225034217      18         0.80689      3.88391      0.80689   10       1711885541     425626811      18         0.92971   1.31309      0.92971 
end example
 

Changing Seed_2 for the CALL RANCAU 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 RANCAU function, however, has no effect.

See Also

Function:

  • 'RANCAU Function' on page 765




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net