PROGRAM
--------------------------------------
DATA D1 ;
CALL STREAMINIT(12345) ; *** DEFINE A
SEED. ***;
DO N=1 TO 5000000 ;
X1=RAND('NORMAL') ;
Y10=ROUND(-10+ 3.0*x1,.1) ;*** Y10∼N(-10, 3) ***;
Y21=ROUND(-13+ 1.0*x1,.1) ;*** Y21∼N(-13, 1.0) ***;
Y22=ROUND(-12+ 1.5*x1,.1) ;*** Y22∼N(-12, 1.5) ***;
Y23=ROUND(- 7+ 2.0*x1,.1) ;*** Y23∼N(-7 , 2.0) ***;
OUTPUT;
END;
RUN ;
PROC SQL ;
CREATE TABLE D10 AS SELECT UNIQUE Y, COUNT(N) AS C_Y10
FROM D1(RENAME=(Y10=Y)) GROUP BY Y
;
CREATE TABLE D21 AS SELECT UNIQUE Y, COUNT(N) AS C_Y21
FROM D1(RENAME=(Y21=Y)) GROUP BY Y
;
CREATE TABLE D22 AS SELECT UNIQUE Y, COUNT(N) AS C_Y22
FROM D1(RENAME=(Y22=Y)) GROUP BY Y
;
CREATE TABLE D23 AS SELECT UNIQUE Y, COUNT(N) AS C_Y23
FROM D1(RENAME=(Y23=Y)) GROUP BY Y
;
QUIT ;
DATA D3 ;
MERGE D10 D21 D22 D23;
BY Y;
IF C_Y10=. THEN C_Y10=0 ;
**
REFERENCE **;
IF C_Y21=. THEN C_Y21=0 ;
** C_Y22 and C_Y23: ADJUSTED BY SD
**;
IF C_Y22=. THEN C_Y22=0 ; C_Y221=C_Y22*1.5/1 ;
IF C_Y23=. THEN C_Y23=0 ; C_Y231=C_Y23*2.0/1 ;
RUN ;
PROC SGPLOT DATA=D3 ;
SERIES X =Y Y =C_Y10 ;
REFLINE -10 /AXIS=X;
XAXIS LABEL="THETA_i" ;
YAXIS DISPLAY=NONE;
RUN ;
PROC SGPLOT DATA=D3 ;
SERIES X =Y Y =C_Y21 ;
SERIES X =Y Y =C_Y221 ;
SERIES X =Y Y =C_Y231 ;
YAXIS DISPLAY=NONE;
RUN ;
--------------------------------------
Post a Comment
別ページに移動します