From 7613a42504327b0da54256fce79389e5f69c92e6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 23 Oct 2017 17:30:52 +0200 Subject: [PATCH] Fix calculation --- Math/Statistic/Average.php | 4 ++-- Math/Statistic/MeasureOfDispersion.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Math/Statistic/Average.php b/Math/Statistic/Average.php index 0bcd1674d..afd73e357 100644 --- a/Math/Statistic/Average.php +++ b/Math/Statistic/Average.php @@ -52,11 +52,11 @@ class Average * * @since 1.0.0 */ - public static function averageChange(array $x, int $h = 1) : float + public static function averageDatasetChange(array $x, int $h = 1) : float { $count = count($x); - return $x[$count - 1] + $h * ($x[$count - 1] - $x[0]) / ($count - 1); + return $h * ($x[$count - 1] - $x[0]) / ($count - 1); } /** diff --git a/Math/Statistic/MeasureOfDispersion.php b/Math/Statistic/MeasureOfDispersion.php index 09bc6d104..b74d931ec 100644 --- a/Math/Statistic/MeasureOfDispersion.php +++ b/Math/Statistic/MeasureOfDispersion.php @@ -47,7 +47,7 @@ class MeasureOfDispersion $end = end($values); $start = reset($values); - return $start - $end; + return $end - $start; } /**