/** * @test */ public function getVariance() { $values = $this->getValuesFromData($this->listFilteredByOneSubgroup(true)); $this->assertEquals(10000, $this->statistic->sampleVariance($values)); $values->rewind(); $this->assertEquals(6666.67, $this->statistic->populationVariance($values)); }
function testVariance(Statistic $statistic){ $values = new ArrayObject(array(3,5,2,1,3,4,6,9,3)); assertEquals($statistic->populationVariance($values->getIterator()), 5.11); assertEquals($statistic->sampleVariance($values->getIterator()), 5.75); }