9 49.7168, 74.3804, 7.0115, 96.5769, 34.9458,
10 36.9947, 33.8926, 89.0774, 23.7745, 73.5154,
11 86.1322, 53.2124, 16.2046, 73.5130, 10.4209,
12 42.7299, 49.3330, 47.0215, 34.9950, 18.2914,
26 foreach( $this->points
as $point ) {
27 $rstat->push( $point );
30 $mean = array_sum( $this->points ) / count( $this->points );
31 $variance = array_sum( array_map(
function ( $x ) use ( $mean ) {
32 return pow( $mean - $x, 2 );
34 $stddev = sqrt( $variance );
36 $this->assertEquals( count( $rstat ), count( $this->points ) );
37 $this->assertEquals( $rstat->min, min( $this->points ) );
38 $this->assertEquals( $rstat->max, max( $this->points ) );
39 $this->assertEquals( $rstat->getMean(), $mean );
40 $this->assertEquals( $rstat->getVariance(), $variance );
41 $this->assertEquals( $rstat->getStdDev(), $stddev );
54 foreach( $this->points
as $point ) {
55 $expected->push( $point );
59 $sets = array_chunk( $this->points, floor( count( $this->points ) / 2 ) );
63 foreach( $sets[0]
as $point ) {
64 $first->push( $point );
69 foreach( $sets[1]
as $point ) {
70 $second->push( $point );
74 $first->merge( $second );
76 $this->assertEquals( count( $first ), count( $this->points ) );
77 $this->assertEquals( $first, $expected );