本文整理汇总了PHP中Stats::sampleStddev方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::sampleStddev方法的具体用法?PHP Stats::sampleStddev怎么用?PHP Stats::sampleStddev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::sampleStddev方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twoSampleTTest
/**
* Two Sample T Test
*
* The two-sample T test tests whether two samples are significantly
* different from each other.
*
* @param array $datax The first sample to test
* @param array $datay The second sample to test
* @return float The probability of having the first sample's population mean be greater than or equal to the second sample's population mean
*/
static function twoSampleTTest(array $datax, array $datay)
{
$df = pow(pow(Stats::sampleStddev($datax), 2) / count($datax) + pow(Stats::sampleStddev($datay), 2) / count($datay), 2) / (pow(pow(Stats::sampleStddev($datax), 2) / count($datax), 2) / (count($datax) - 1) + pow(pow(Stats::sampleStddev($datay), 2) / count($datay), 2) / (count($datay) - 1));
$sampleT = (Stats::average($datax) - Stats::average($datay)) / sqrt(pow(Stats::sampleStddev($datax), 2) / count($datax) + pow(Stats::sampleStddev($datay), 2) / count($datay));
return \PHPStats\ProbabilityDistribution\StudentsT::getCdf($sampleT, $df);
}