Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.1

Bug #17924 frequency and test suite broken
Submitted: 2010-10-03 20:25 UTC
From: remicollet Assigned: remicollet
Status: Closed Package: Math_Stats (version 0.9.0)
PHP Version: 5_3 SVN-2010-10-03 OS: GNU/Linux (Fedora 13)
Roadmaps: (Not assigned)    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 19 + 45 = ?

 
 [2010-10-03 20:25 UTC] remicollet (Remi Collet)
Description: ------------ Frequency computation is broken, and so, running test fails The attached patch fixe this issue Test script: --------------- phpunit AllTests.php Expected result: ---------------- PHPUnit 3.5.0 by Sebastian Bergmann. ........................................ Time: 1 second, Memory: 7.00Mb OK (40 tests, 237 assertions) Actual result: -------------- PHPUnit 3.5.0 by Sebastian Bergmann. ..F...................F.......F.......FF Time: 0 seconds, Memory: 7.25Mb There were 5 failures: 1) Math_StatsTest::testCalcFull out2 Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ [mode : - [0 : 0.6268] + [0 : 1.165] + [1 : 0.6268] + [2 : 0.3516] + [3 : 0.0751] + [4 : -0.6965] @@ @@ [0.3516 : 1] - [0.6268 : 2] + [0.6268 : 1] [1.165 : 1] ] [quartiles : [25 : -0.3107] [50 : 0.4892] [75 : 0.8959] ] [interquartile_range : 1.2066] [interquartile_mean : 0.420075] [quartile_deviation : 0.6033] [quartile_variation_coefficient : 206.185919344] [quartile_skewness_coefficient : -0.325874357699] /usr/share/pear/test/Math_Stats/tests/Math_StatsTest.php:119 2) Math_StatsTest::testMode Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -[0 : 0.6268] +[0 : 1.165] +[1 : 0.6268] +[2 : 0.3516] +[3 : 0.0751] +[4 : -0.6965] /usr/share/pear/test/Math_Stats/tests/Math_StatsTest.php:531 3) Math_StatsTest::testFrequency Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ [-0.6965 : 1] [0.0751 : 1] [0.3516 : 1] -[0.6268 : 2] +[0.6268 : 1] [1.165 : 1] /usr/share/pear/test/Math_Stats/tests/Math_StatsTest.php:681 4) Math_StatsTest::testStudentize Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ [mode : - [0 : -0.858630217475] + [0 : 0.721670796282] + [1 : 1.03773099903] + [2 : 1.22736712068] + [3 : 1.66985140454] + [4 : 0.405610593531] + [5 : -0.100085730871] + [6 : -0.858630217475] + [7 : -0.668994095824] + [8 : -0.226509811972] + [9 : -1.49075062298] @@ @@ [-1.49075062298 : 1] - [-0.858630217475 : 3] + [-0.858630217475 : 1] [-0.668994095824 : 1] [-0.226509811972 : 1] [-0.100085730871 : 1] [0.405610593531 : 1] [0.721670796282 : 1] [1.03773099903 : 1] [1.22736712068 : 1] [1.66985140454 : 1] ] [quartiles : [25 : -0.858630217475] [50 : -0.163297771422] [75 : 0.879700897658] ] [interquartile_range : 1.73833111513] [interquartile_mean : -0.30552486266] [quartile_deviation : 0.869165557566] [quartile_variation_coefficient : 8250] [quartile_skewness_coefficient : 0.2] /usr/share/pear/test/Math_Stats/tests/Math_StatsTest.php:846 5) Math_StatsTest::testCenter Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ [mode : - [0 : -1.35833333333] + [0 : 1.14166666667] + [1 : 1.64166666667] + [2 : 1.94166666667] + [3 : 2.64166666667] + [4 : 0.641666666667] + [5 : -0.158333333333] + [6 : -1.35833333333] + [7 : -1.05833333333] + [8 : -0.358333333333] + [9 : -2.35833333333] @@ @@ [-2.35833333333 : 1] - [-1.35833333333 : 3] + [-1.35833333333 : 1] [-1.05833333333 : 1] [-0.358333333333 : 1] [-0.158333333333 : 1] [0.641666666667 : 1] [1.14166666667 : 1] [1.64166666667 : 1] [1.94166666667 : 1] [2.64166666667 : 1] ] [quartiles : [25 : -1.35833333333] [50 : -0.258333333333] [75 : 1.39166666667] ] [interquartile_range : 2.75] [interquartile_mean : -0.483333333333] [quartile_deviation : 1.375] [quartile_variation_coefficient : 8250] [quartile_skewness_coefficient : 0.2] /usr/share/pear/test/Math_Stats/tests/Math_StatsTest.php:859 FAILURES! Tests: 40, Assertions: 221, Failures: 5.

Comments

 [2010-10-03 20:26 UTC] remicollet (Remi Collet)
 [2010-10-04 17:06 UTC] doconnor (Daniel O'Connor)
Ah, handy. That'll learn me to fix E_NOTICE bugs. So; i'm a touch confused as to why the change here results in different behaviour: http://svn.php.net/viewvc/pear/packages/Math_Stats/trunk/Math/Stats.php?r1=234733&r2=303952 Were there some instances where $freq[$val] = null?
 [2010-10-04 17:08 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: remicollet
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2010-10-04 22:32 UTC] remicollet (Remi Collet)
> Were there some instances where $freq[$val] = null? No simply an array index couldn't be a float. From doc http://fr2.php.net/manual/en/language.types.array.php Floats in key are truncated to integer. So $freq[0.6258] => $freq[0] But $freq["0.6258"] is ok.