LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 25 Apr 1998 12:09:16 -0600
Reply-To:   jshi@KUHUB.CC.UKANS.EDU
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Jingren Shi <jshi@KUHUB.CC.UKANS.EDU>
Organization:   Deja News - The Leader in Internet Discussion
Subject:   random generation

How to generate chi square, t and F distribution,

If you have x that is normally dritributed, you may generate chi square distribution. If you have normall dritribution and chi square distribution, you may generate student distribution and F distibution.

How to randomly draw a simple size 2 from 10 without replacement, The general proof may be difficult. You may think a simple case selecting 2 out of 3. The simulation result seems good.

data t1; do index = 1 to 10; var=ranuni(0); output; end; run;

proc sort data = t1 out=t2; by var; run;

data t3; set t2(obs=2); run;

/* here is the simulation */

libname sd '~model03/sas'; %macro doloop; %do i = 0 %to 10000;

data t1; do index = 1 to 10; var=ranuni(&i*2); output; end; run;

proc sort data = t1 out=t2; by var; run;

data t3; set t2(obs=2); run;

proc append base=base data=t3; run;

%end; %mend;

%doloop;

proc freq data=base; table index /out=sd.out; run;

/* here is the result */

The SAS System 00:51 Saturday, April 25, 1998 1

Cumulative Cumulative INDEX Frequency Percent Frequency Percent --------------------------------------------------- 1 2011 10.1 2011 10.1 2 1970 9.8 3981 19.9 3 2043 10.2 6024 30.1 4 2023 10.1 8047 40.2 5 1971 9.9 10018 50.1 6 1995 10.0 12013 60.1 7 2026 10.1 14039 70.2 8 2028 10.1 16067 80.3 9 1972 9.9 18039 90.2 10 1963 9.8 20002 100.0

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading


Back to: Top of message | Previous page | Main SAS-L page