Convert to Junit4
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1083965 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60c76a7501
commit
460b8bba3b
|
@ -17,17 +17,19 @@
|
|||
|
||||
package org.apache.commons.math.distribution;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test cases for {@link KolmogorovSmirnovDistributionImpl}.
|
||||
*
|
||||
* @version $Revision$ $Date$
|
||||
*/
|
||||
public class KolmogorovSmirnovDistributionTest extends TestCase {
|
||||
public class KolmogorovSmirnovDistributionTest {
|
||||
|
||||
private static final double TOLERANCE = 10e-10;
|
||||
|
||||
@Test
|
||||
public void testCumulativeDensityFunction() throws Exception {
|
||||
|
||||
KolmogorovSmirnovDistributionImpl dist;
|
||||
|
@ -43,73 +45,73 @@ public class KolmogorovSmirnovDistributionTest extends TestCase {
|
|||
* 4.907829957616471622388047046469198862537e-86
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(200);
|
||||
assertEquals(4.907829957616471622388047046469198862537e-86, dist.cdf(0.005, false), TOLERANCE);
|
||||
Assert.assertEquals(4.907829957616471622388047046469198862537e-86, dist.cdf(0.005, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.02), n = as.integer(200), PACKAGE = "stats")$p, 40) gives
|
||||
* 5.151982014280041957199687829849210629618e-06
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(200);
|
||||
assertEquals(5.151982014280041957199687829849210629618e-06, dist.cdf(0.02, false), TOLERANCE);
|
||||
Assert.assertEquals(5.151982014280041957199687829849210629618e-06, dist.cdf(0.02, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.031111), n = as.integer(200), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.01291614648162886340443389343590752105229
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(200);
|
||||
assertEquals(0.01291614648162886340443389343590752105229, dist.cdf(0.031111, false), TOLERANCE);
|
||||
Assert.assertEquals(0.01291614648162886340443389343590752105229, dist.cdf(0.031111, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.04), n = as.integer(200), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.1067137011362679355208626930107129737735
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(200);
|
||||
assertEquals(0.1067137011362679355208626930107129737735, dist.cdf(0.04, false), TOLERANCE);
|
||||
Assert.assertEquals(0.1067137011362679355208626930107129737735, dist.cdf(0.04, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.005), n = as.integer(341), PACKAGE = "stats")$p, 40) gives
|
||||
* 1.914734701559404553985102395145063418825e-53
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(341);
|
||||
assertEquals(1.914734701559404553985102395145063418825e-53, dist.cdf(0.005, false), TOLERANCE);
|
||||
Assert.assertEquals(1.914734701559404553985102395145063418825e-53, dist.cdf(0.005, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.02), n = as.integer(341), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.001171328985781981343872182321774744195864
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(341);
|
||||
assertEquals(0.001171328985781981343872182321774744195864, dist.cdf(0.02, false), TOLERANCE);
|
||||
Assert.assertEquals(0.001171328985781981343872182321774744195864, dist.cdf(0.02, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.031111), n = as.integer(341), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.1142955196267499418105728636874118819833
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(341);
|
||||
assertEquals(0.1142955196267499418105728636874118819833, dist.cdf(0.031111, false), TOLERANCE);
|
||||
Assert.assertEquals(0.1142955196267499418105728636874118819833, dist.cdf(0.031111, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.04), n = as.integer(341), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.3685529520496805266915885113121476024389
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(341);
|
||||
assertEquals(0.3685529520496805266915885113121476024389, dist.cdf(0.04, false), TOLERANCE);
|
||||
Assert.assertEquals(0.3685529520496805266915885113121476024389, dist.cdf(0.04, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.005), n = as.integer(389), PACKAGE = "stats")$p, 40) gives
|
||||
* 1.810657144595055888918455512707637574637e-47
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(389);
|
||||
assertEquals(1.810657144595055888918455512707637574637e-47, dist.cdf(0.005, false), TOLERANCE);
|
||||
Assert.assertEquals(1.810657144595055888918455512707637574637e-47, dist.cdf(0.005, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.02), n = as.integer(389), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.003068542559702356568168690742481885536108
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(389);
|
||||
assertEquals(0.003068542559702356568168690742481885536108, dist.cdf(0.02, false), TOLERANCE);
|
||||
Assert.assertEquals(0.003068542559702356568168690742481885536108, dist.cdf(0.02, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.031111), n = as.integer(389), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.1658291700122746237244797384846606291831
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(389);
|
||||
assertEquals(0.1658291700122746237244797384846606291831, dist.cdf(0.031111, false), TOLERANCE);
|
||||
Assert.assertEquals(0.1658291700122746237244797384846606291831, dist.cdf(0.031111, false), TOLERANCE);
|
||||
|
||||
/* formatC(.C("pkolmogorov2x", p = as.double(0.04), n = as.integer(389), PACKAGE = "stats")$p, 40) gives
|
||||
* 0.4513143712128902529379104180407011881471
|
||||
*/
|
||||
dist = new KolmogorovSmirnovDistributionImpl(389);
|
||||
assertEquals(0.4513143712128902529379104180407011881471, dist.cdf(0.04, false), TOLERANCE);
|
||||
Assert.assertEquals(0.4513143712128902529379104180407011881471, dist.cdf(0.04, false), TOLERANCE);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue