1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.hipparchus.distribution.continuous;
23
24 import org.hipparchus.util.Precision;
25 import org.junit.Assert;
26 import org.junit.Test;
27
28
29
30
31 public class GumbelDistributionTest extends RealDistributionAbstractTest {
32
33 @Test
34 public void testParameters() {
35 GumbelDistribution d = makeDistribution();
36 Assert.assertEquals(0.5, d.getLocation(), Precision.EPSILON);
37 Assert.assertEquals(2, d.getScale(), Precision.EPSILON);
38 }
39
40 @Test
41 public void testSupport() {
42 GumbelDistribution d = makeDistribution();
43 Assert.assertTrue(Double.isInfinite(d.getSupportLowerBound()));
44 Assert.assertTrue(Double.isInfinite(d.getSupportUpperBound()));
45 Assert.assertTrue(d.isSupportConnected());
46 }
47
48 @Override
49 public GumbelDistribution makeDistribution() {
50 return new GumbelDistribution(0.5, 2);
51 }
52
53 @Override
54 public double[] makeCumulativeTestPoints() {
55 return new double[] {
56 -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
57 };
58 }
59
60 @Override
61 public double[] makeDensityTestValues() {
62 return new double[] {
63 1.258262e-06, 3.594689e-04, 9.115766e-03, 5.321100e-02, 1.274352e-01, 1.777864e-01,
64 1.787177e-01, 1.472662e-01, 1.075659e-01, 7.302736e-02, 4.742782e-02
65 };
66 }
67
68 @Override
69 public double[] makeCumulativeTestValues() {
70 return new double[] {
71 1.608760e-07, 7.577548e-05, 3.168165e-03, 3.049041e-02, 1.203923e-01, 2.769203e-01,
72 4.589561e-01, 6.235249e-01, 7.508835e-01, 8.404869e-01, 8.999652e-01
73 };
74 }
75
76 }