This page is done using SAS 9.2. In a simple example, we’ll see if the distribution of writing test scores across gender are equal using the High-School and Beyond 2000 data set, hsb2. We will conduct the Kolmogorov-Smirnov test for equality of distribution functions using proc npar1way. We’ll first do a kernel density plot of writing scores by gender.
ods graphics on; proc univariate data = hsb2 normal; class female; var write; histogram /normal kernel; run;
proc npar1way data = hsb2; class female; var write; run; The NPAR1WAY Procedure Kolmogorov-Smirnov Test for Variable write Classified by Variable female EDF at Deviation from Mean female N Maximum at Maximum ___________________________________________________ 0 91 0.494505 1.283101 1 109 0.247706 -1.172379 Total 200 0.360000 Maximum Deviation Occurred at Observation 89 Value of write at Maximum = 49.0 Kolmogorov-Smirnov Two-Sample Test (Asymptotic) KS 0.122899 D 0.246799 KSa 1.738051 Pr > KSa 0.0048 [remaining of output omitted]
From the test, it is apparent that the writing scores across gender do not have the same distribution function.