本文整理汇总了PHP中pts_math::first_quartile方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_math::first_quartile方法的具体用法?PHP pts_math::first_quartile怎么用?PHP pts_math::first_quartile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_math
的用法示例。
在下文中一共展示了pts_math::first_quartile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_iqr_outlier_results
public function clear_iqr_outlier_results()
{
$is_multi_way = pts_render::multi_way_identifier_check($this->get_identifiers());
if ($is_multi_way) {
$group_values = array();
$group_keys = array();
foreach ($this->buffer_items as $key => &$buffer_item) {
$identifier_r = pts_strings::trim_explode(': ', $buffer_item->get_result_identifier());
if (!isset($group_values[$identifier_r[1]])) {
$group_values[$identifier_r[1]] = array();
$group_keys[$identifier_r[1]] = array();
}
$group_values[$identifier_r[1]][] = $buffer_item->get_result_value();
$group_keys[$identifier_r[1]][] = $key;
}
foreach ($group_values as $group_key => $values) {
// From: http://www.mathwords.com/o/outlier.htm
$fqr = pts_math::first_quartile($values);
$tqr = pts_math::third_quartile($values);
$iqr_cut = ($tqr - $fqr) * 1.5;
$bottom_cut = $fqr - $iqr_cut;
$top_cut = $tqr + $iqr_cut;
foreach ($group_keys[$group_key] as $key) {
$value = $this->buffer_items[$key]->get_result_value();
if ($value > $top_cut || $value < $bottom_cut) {
unset($this->buffer_items[$key]);
}
}
}
} else {
// From: http://www.mathwords.com/o/outlier.htm
$values = $this->get_values();
$fqr = pts_math::first_quartile($values);
$tqr = pts_math::third_quartile($values);
$iqr_cut = ($tqr - $fqr) * 1.5;
$bottom_cut = $fqr - $iqr_cut;
$top_cut = $tqr + $iqr_cut;
foreach ($this->buffer_items as $key => &$buffer_item) {
$value = $buffer_item->get_result_value();
if ($value > $top_cut || $value < $bottom_cut) {
unset($this->buffer_items[$key]);
}
}
}
}