package com.imsl.test.example.stat; import com.imsl.stat.*; /** *

* Performs a Kolmogorov two-sample test.

* This example performs the Kolmogorov two-sample test on two independent * pseudorandom samples from a uniform\((0,1)\) distribution. Since the two * theoretical distributions are identical, we would not expect to reject the * null hypothesis. * * * @see Code * @see Output */ public class KolmogorovTwoSampleEx1 { static public void main(String arg[]) { double x[] = new double[100]; double y[] = new double[60]; Random random = new Random(123457); random.setMultiplier(16807); for (int i = 0; i < x.length; i++) { x[i] = random.nextFloat(); } for (int i = 0; i < y.length; i++) { y[i] = random.nextFloat(); } KolmogorovTwoSample k2s = new KolmogorovTwoSample(x, y); System.out.println("D = " + k2s.getTestStatistic()); System.out.println("D+ = " + k2s.getMaximumDifference()); System.out.println("D- = " + k2s.getMinimumDifference()); System.out.println("Z = " + k2s.getZ()); System.out.println("Prob greater D one sided = " + k2s.getOneSidedPValue()); System.out.println("Prob greater D two sided = " + k2s.getTwoSidedPValue()); System.out.println("Missing X = " + k2s.getNumberMissingX()); System.out.println("Missing Y = " + k2s.getNumberMissingY()); } }