@@ -16,19 +16,21 @@ KolmogorovSmirnov2sampleTest >> initialize [
1616KolmogorovSmirnov2sampleTest >> testRejectOfEqualityHypothesesForTwoSamples [
1717 | nd ks |
1818 nd := PMNormalDistribution new .
19- ks := PMKolmogorovSmirnov2Sample compareData: ((1 to: 100 ) collect: [ :i | nd random ]) withData: ((1 to: 100 ) collect: [ :i | nd random ]). " -->
20- a KolmogorovSmirnov2Sample(dataSize: 100 otherDataSize: 100)"
21- ks ksStatistic. " -->(9/100)"
22- ks pValue asFloat. " -->0.18458528753386905"
23- self assert: (ks rejectEqualityHypothesisWithAlpha: 0.05 ) equals: false
19+ ks := PMKolmogorovSmirnov2Sample
20+ compareData: ((1 to: 100 ) collect: [ :i | nd random ])
21+ withData: ((1 to: 100 ) collect: [ :i | nd random ]).
22+ ks ksStatistic.
23+ ks pValue asFloat.
24+ self
25+ assert: (ks rejectEqualityHypothesisWithAlpha: 0.05 )
26+ equals: false
2427]
2528
2629{ #category : #tests }
2730KolmogorovSmirnov2sampleTest >> testSecondSmallSample [
28- " sample from
29- Kim, P. J. & Jennrich, R. I.
30- Tables of the exact sampling distribution of the two-sample Kolmogorov–Smirnov criterion
31- in Selected Tables in Mathematical Statistics Volume I (1973)"
31+ " sample from Kim, P. J. & Jennrich, R. I.
32+ Tables of the exact sampling distribution of the two-sample Kolmogorov–Smirnov criterion
33+ in Selected Tables in Mathematical Statistics Volume I (1973)"
3234
3335 | d1 d2 |
3436 d1 := #(0.723 0.382 -0.854 -1.318 0.847 -0.41 -0.111) .
@@ -56,7 +58,7 @@ KolmogorovSmirnov2sampleTest >> testSmallSample [
5658 k data: d1.
5759 k otherData: d2.
5860 self assert: (1 - k pValue asFloat roundTo: 0.00001 ) equals: 0.06063 .
59- self assert: k ksStatistic equals: 5 / 9 . " 0.55555...6 "
61+ self assert: k ksStatistic equals: 5 / 9 .
6062 self deny: (k rejectEqualityHypothesisWithAlpha: 0.05 ).
6163 self assert: (k rejectEqualityHypothesisWithAlpha: 0.07 )
6264]
0 commit comments