UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS FAQ
How can I test for equality of distribution?

An alternative test to the classic t-test is the Kolmogorov-Smirnov test for equality of distribution functions. 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. We'll first do a kernel density plot of writing scores by gender.
proc sort data = "E:\temp\hsb2";
by female;
run;

proc capability data="E:\temp\hsb2" noprint; 
comphist write / class = female kernel cfill=white cbarline = white;
run;
proc npar1way data = "E:\temp\hsb2" edf;
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 have the same distribution function.

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California