Kurtosis SAS g1g2.sas; • data EDA; infile 'C:\Users\Vati\Documents\StatData\EDA.d at'; input Y; • proc means mean skewness kurtosis N; var Y; run; Analysis Variable : Y Mean Skewness 72.5104167 0.5255689 Kurtosis 0.0323668 N 96 Standardize the Scores • PROC STANDARD data=eda mean=0 std=1 out=z_scores; run; • proc means mean skewness kurtosis N; var Y; run; Analysis Variable : Y Mean Skewness -4.09395E-16 0.5255689 Kurtosis 0.0323668 N 96 Note: No change in values of Skewness and Kurtosis. Compute z3 & z4 • data z34; set z_scores; • Z3=Y**3; Z4=Y**4; • proc means data=z34 noprint; var Z3 Z4; output out=sumZ34 N=N N4 sum=sumZ3 sumZ4; run; Compute g1 & g2 • data skew; set sumz34; G1=N/(n-1)/(n2)*sumZ3; • G2=N*(n+1)/(n-1)/(n-2)/(n-3)*sumZ4 3*(n-1)*(n-1)/(n-2)/(n-3); proc print; run; N 96 N4 96 sumZ3 48.8889 sumZ4 279.103 G1 G2 0.52557 0.032367 Same values as computed with Proc Means. Create Large Uniform Sample • DATA uniform; DROP N; DO N=1 TO 500000; X=UNIFORM(0); OUTPUT; END; • PROC MEANS mean std skewness kurtosis; VAR X; run; Analysis Variable : X Mean Std Dev 0.5002771 0.2888593 Skewness 0.0012401 Kurtosis -1.2009090 Skewness and Kurtosis have their expected values, 0 and -1.2. *Kurtosis-T.sas; *************************************************************** options formdlim='-' pageno=min nodate; TITLE 'T ON 9 DF, T COMPUTED ON EACH OF 500,000 SAMPLES'; TITLE2 'EACH WITH 10 SCORES FROM A STANDARD NORMAL POPULATION'; run; DATA T9; DROP N; DO SAMPLE=1 TO 500000; DO N=1 TO 10; X=NORMAL(0); OUTPUT; END; END; PROC MEANS NOPRINT; OUTPUT OUT=TS T=T; VAR X; BY SAMPLE; PROC MEANS MEAN STD N KURTOSIS; VAR T; run; Student’s t on 9 df Analysis Variable : T Mean Std Dev N Kurtosis -0.0007 1.13545 500000 1.23472 DATA T16; DROP N; DO SAMPLE=1 TO 500000; DO N=1 TO 17; X=NORMAL(0); OUTPUT; END; END; PROC MEANS NOPRINT; OUTPUT OUT=TS T=T; VAR X; BY SAMPLE; TITLE 'T ON 16 DF, SAMPLING DISTRIBUTION OF 500,000 TS'; run; PROC MEANS MEAN STD N KURTOSIS; VAR T; run; Analysis Variable : T Mean Std Dev N 0.000424 1.06708 500000 Kurtosis 0.47135 DATA T28; DROP N; DO SAMPLE=1 TO 500000; DO N=1 TO 29; X=NORMAL(0); OUTPUT; END; END; PROC MEANS NOPRINT; OUTPUT OUT=TS T=T; VAR X; BY SAMPLE; TITLE 'T ON 28 DF, SAMPLING DISTRIBUTION OF 500,000 TS'; run; PROC MEANS MEAN STD N KURTOSIS; VAR T; run; Analysis Variable : T Mean Std Dev N 0.000321 1.03727 500000 Kurtosis 0.24623 *Kurtosis_Beta2.sas; *Illustrates the computation of population kurtosis; *Using data from the handout Skewness, Kurtosis, and the Normal Curve; data A; do s=1 to 20; X=5; output; X=15; output; end; *Creates distribution with 20 scores of 5 and 20 of 15; data ZA; set A; Z=(X-10)/5; Z4A=Z**4; *Changes score to z scores and then raises them to the 4th power; proc means mean; var Z4A; run; *Finds the mean (aka ‘expected value’) of z**4; Analysis Variable: Z4A 2 2 Mean 1.0000000 = 1, = 2 -3 = -2 • The rest of the program uses the same definition of 2 to verify the values of 2 reported in the handout. *Kurtosis-Normal.sas; ************************************************************************** options formdlim='-' pageno=min nodate; TITLE 'Skewness and Kurtosis for 100,000 Samples of 1000 Scores Drawn From a Normal (0,1) Distribution'; run; DATA normal; DROP N; DO SAMPLE=1 TO 100000; DO N=1 TO 1000; X=NORMAL(0); OUTPUT; END; END; PROC MEANS NOPRINT; OUTPUT OUT=SK_KUR SKEWNESS=SKEWNESS KURTOSIS=KURTOSIS; VAR X; BY SAMPLE; PROC MEANS MEAN STD N; VAR skewness kurtosis; run;