public StudentTOneTailedCriticalValueCalculator(double nu) { ArgChecker.notNegative(nu, "nu"); _dist = new StudentTDistribution(nu); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeDOF1() { new StudentTDistribution(-2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullEngine() { new StudentTDistribution(2, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeDOF2() { new StudentTDistribution(-2, ENGINE); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEngine() { new StudentTDistribution(3, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullEngine() { new StudentTDistribution(3, null); }
public StudentTOneTailedCriticalValueCalculator(double nu, RandomEngine engine) { ArgChecker.notNegative(nu, "nu"); ArgChecker.notNull(engine, "engine"); _dist = new StudentTDistribution(nu, engine); }
@Test public void test() { ProbabilityDistribution<Double> dist = new StudentTDistribution(1, ENGINE); assertCDFWithNull(dist); assertPDFWithNull(dist); assertInverseCDF(X, dist); for (int i = 0; i < 10; i++) { dist = new StudentTDistribution(DOF[i], ENGINE); assertEquals(P[i], dist.getCDF(X[i]), EPS); } }
@Test public void testObject() { final double dof = 2.4; final StudentTDistribution dist = new StudentTDistribution(dof, ENGINE); StudentTDistribution other = new StudentTDistribution(dof, ENGINE); assertEquals(dist, other); assertEquals(dist.hashCode(), other.hashCode()); other = new StudentTDistribution(dof); assertEquals(dist, other); assertEquals(dist.hashCode(), other.hashCode()); other = new StudentTDistribution(dof + 1, ENGINE); assertFalse(dist.equals(other)); } }
@Test public void testNormal() { final ProbabilityDistribution<Double> highDOF = new StudentTDistribution(1000000, ENGINE); final ProbabilityDistribution<Double> normal = new NormalDistribution(0, 1, ENGINE); final double eps = 1e-4; double x; for (int i = 0; i < 100; i++) { x = RANDOM.nextDouble(); assertEquals(highDOF.getCDF(x), normal.getCDF(x), eps); assertEquals(highDOF.getPDF(x), normal.getPDF(x), eps); assertEquals(highDOF.getInverseCDF(x), normal.getInverseCDF(x), eps); } }