7.5.5 Testing a distribution with the Kolmogorov-Smirnov
distribution: kolmogorovt
The kolmogorovt command will use the Kolmogorov test to compare
sample data to a specified continuous distribution.
You need to provide kolmogorovt with either two lists of data
or a list of data followed by the name of a distribution with the
parameters.
The kolmogorovt command will return three values:
-
The D statistic, which is the maximum distance between the
cumulative distribution functions of the samples or the sample and
the given distribution.
- The K value, where K = D√n (for a single data set,
where n is the size of the data set) or K=D√n1 n2 /(n1 +
n2) (when there are two data sets, with sizes n1 and n2).
The K value will tend towards the Kolmogorov-Smirnov distribution
as the size of the data set goes to infinity.
- 1 - kolmogorovd(K), which will be close to 1 when the
distributions look like they match.
For example, if you enter
kolmogorovt(randvector(100,normald,0,1),normald(0,1))
you might get
["D=",0.112592987625,"K=",1.12592987625,"1-kolmogorovd(K)=",0.158375510292]
and if you enter
kolmogorovt(randvector(100,normald,0,1),student(2))
you might get
["D=",0.0996114067923,"K=",0.996114067923,"1-kolmogorovd(K)=",0.27418851907]