33
33
public WeibullDistributionTest(String arg0) {
37
37
//-------------- Implementations for abstract methods -----------------------
39
39
/** Creates the default continuous distribution instance to use in tests. */
41
public ContinuousDistribution makeDistribution() {
41
public WeibullDistribution makeDistribution() {
42
42
return new WeibullDistributionImpl(1.2, 2.1);
45
45
/** Creates the default cumulative probability distribution test input values */
47
47
public double[] makeCumulativeTestPoints() {
48
// quantiles computed using Mathematica
49
return new double[] {0.00664355181d, 0.04543282833d, 0.09811627374d,
50
0.1767135246d, 0.3219468654d, 4.207902826d, 5.23968437d,
51
6.232056007d, 7.497630467d, 10.51154969d};
48
// quantiles computed using R version 2.9.2
49
return new double[] {0.00664355180993, 0.0454328283309, 0.0981162737374, 0.176713524579, 0.321946865392,
50
10.5115496887, 7.4976304671, 6.23205600701, 5.23968436955, 4.2079028257};
54
53
/** Creates the default cumulative probability density test expected values */
56
55
public double[] makeCumulativeTestValues() {
57
return new double[] {0.001d, 0.01d, 0.025d, 0.05d, 0.1d, 0.900d, 0.950d,
58
0.975d, 0.990d, 0.999d};
56
return new double[] {0.001, 0.01, 0.025, 0.05, 0.1, 0.999, 0.990, 0.975, 0.950, 0.900};
59
/** Creates the default probability density test expected values */
61
public double[] makeDensityTestValues() {
62
return new double[] {0.180535929306, 0.262801138133, 0.301905425199, 0.330899152971,
63
0.353441418887, 0.000788590320203, 0.00737060094841, 0.0177576041516, 0.0343043442574, 0.065664589369};
61
66
//---------------------------- Additional test cases -------------------------
63
68
public void testInverseCumulativeProbabilityExtremes() throws Exception {
64
69
setInverseCumulativeTestPoints(new double[] {0.0, 1.0});
65
70
setInverseCumulativeTestValues(
66
71
new double[] {0.0, Double.POSITIVE_INFINITY});
67
72
verifyInverseCumulativeProbabilities();
70
75
public void testAlpha() {
71
76
WeibullDistribution distribution = (WeibullDistribution) getDistribution();
72
77
double expected = Math.random();
73
78
distribution.setShape(expected);
74
79
assertEquals(expected, distribution.getShape(), 0.0);
77
82
public void testBeta() {
78
83
WeibullDistribution distribution = (WeibullDistribution) getDistribution();
79
84
double expected = Math.random();
80
85
distribution.setScale(expected);
81
86
assertEquals(expected, distribution.getScale(), 0.0);
84
89
public void testSetAlpha() {
85
90
WeibullDistribution distribution = (WeibullDistribution) getDistribution();