commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r921631 - /commons/proper/math/trunk/src/test/R/pascalTestCases
Date Wed, 10 Mar 2010 23:40:43 GMT
Author: psteitz
Date: Wed Mar 10 23:40:42 2010
New Revision: 921631

URL: http://svn.apache.org/viewvc?rev=921631&view=rev
Log:
Increased precision, fixed failing tests.

Modified:
    commons/proper/math/trunk/src/test/R/pascalTestCases

Modified: commons/proper/math/trunk/src/test/R/pascalTestCases
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/R/pascalTestCases?rev=921631&r1=921630&r2=921631&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/R/pascalTestCases (original)
+++ commons/proper/math/trunk/src/test/R/pascalTestCases Wed Mar 10 23:40:42 2010
@@ -26,7 +26,7 @@
 # pnbinom(q, size, prob, mu, lower.tail = TRUE, log.p = FALSE) <- distribution
 # qnbinom(p, size, prob, mu, lower.tail = TRUE, log.p = FALSE) <- quantiles
 #------------------------------------------------------------------------------
-tol <- 1E-4                       # error tolerance for tests
+tol <- 1E-9                       # error tolerance for tests
 #------------------------------------------------------------------------------
 # Function definitions
 
@@ -73,11 +73,12 @@ size <- 10.0
 probability <- 0.70
 
 densityPoints <- c(-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-densityValues <- c(0, 0.02824, 0.08474, 0.13982, 
-          0.16779, 0.16359, 0.1374, 0.10306, 0.070673, 0.04505, 0.02703,
-          0.01540, 0.0084)
-distributionValues <- c(0, 0.02824, 0.11299, 0.25281, 0.42060, 0.58420,
-          0.72162, 0.82468, 0.89535, 0.94041, 0.967446, 0.98285, 0.99125)
+densityValues <- c(0, 0.0282475249, 0.0847425747, 0.139825248255, 0.167790297906, 0.163595540458,
+          0.137420253985, 0.103065190489, 0.070673273478, 0.0450542118422, 0.0270325271053,
+          0.0154085404500, 0.0084046584273)
+distributionValues <- c(0, 0.0282475249, 0.1129900996, 0.252815347855, 0.420605645761,
0.584201186219,
+          0.721621440204, 0.824686630693, 0.895359904171, 0.940414116013, 0.967446643119,
+          0.982855183569, 0.991259841996)
 inverseCumPoints <- c( 0, 0.001, 0.010, 0.025, 0.050, 0.100, 0.999,
           0.990, 0.975, 0.950, 0.900)
 inverseCumValues <- c(-1, -1, -1, -1, 0, 0, 13, 10, 9, 8, 7)
@@ -107,22 +108,28 @@ size <- 5
 probability <- 0.0
 
 densityPoints <- c(-1, 0, 1, 10, 11)
-densityValues <- c(0, 0, 0, 0, 0)
+# Note: commons math returns 0's below
+densityValues <- c(NaN, NaN, NaN, NaN, NaN)
 distributionPoints <- c(-1, 0, 1, 5, 10)
-distributionValues <- c(0, 0, 0, 0, 0)
+# Note: commons math returns 0's below
+distributionValues <- c(NaN, NaN, NaN, NaN, NaN)
 
+output <- c("Density test n = ", size, ", p = ", probability)
 verifyDensity(densityPoints,densityValues,size,probability,tol)
+output <- c("Distribution test n = ", size, ", p = ", probability)
 verifyDistribution(distributionPoints,distributionValues,size,probability,tol)
 
 size <- 5
 probability <- 1.0
 
 densityPoints <- c(-1, 0, 1, 2, 5, 10)
-densityValues <- c(0, 1, 0, 0, 1, 0)
+densityValues <- c(0, 1, 0, 0, 0, 0)
 distributionPoints <- c(-1, 0, 1, 2, 5, 10)
 distributionValues <- c(0, 1, 1, 1, 1, 1)
 
+output <- c("Density test n = ", size, ", p = ", probability)
 verifyDensity(densityPoints,densityValues,size,probability,tol)
+output <- c("Distribution test n = ", size, ", p = ", probability)
 verifyDistribution(distributionPoints,distributionValues,size,probability,tol)
 
 displayDashes(WIDTH)



Mime
View raw message