function improvedPageHinkley($list, $lambda) { $alphaPH = function ($t) { $used_list = array_slice($list, 0, $t); return sqrt(ll_variance($used_list)); }; $mean = ll_mean($used_list); return _PageHinkleyStatistic($list, count($list), ll_sign($list[count($list) - 1] - $mean), $alphaPH(count($list)) / 2) > $lambda; }
protected function computeParameters($xs) { if (!is_array($xs[0])) { $xs = $this->arrayNonArray($xs); } $xs_columns = ll_transpose($xs); foreach ($xs_columns as $index => $column) { $this->mean[$index] = ll_mean($column); $this->variance[$index] = ll_variance($column); } }