本文整理匯總了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]);
}
}
}
}