/** * @dataProvider standardDeviationProvider * * @param array $sample * @param boolean Apply Bessel's standard correction? * @param number $expected */ public function testStandardDeviation(array $sample, $correction, $expected) { $result = OperatorsUtils::standardDeviation($sample, $correction); if (is_bool($expected)) { $this->assertSame($expected, $result); } else { $this->assertSame($expected, round($result, 2)); } }
/** * * @return null, \qtism\common\datatypes\Float */ protected function processPopSD() { $operands = $this->getOperands(); $operand = $operands[0]; $result = OperatorsUtils::standardDeviation(self::filterValues($operand->getArrayCopy()), false); return $result !== false ? new QtiFloat(floatval($result)) : null; }